Perform Operation on AD User Without DN

The unique identifier we use throughout our organisation is the users employee ID which has traditionally been put in to the Initials field on the General tab.
When HR are processing employees that exit the company, they have easy access to the users name and ID but not to their username which unfortunately is not at all what you would call a a consistent format.
I have plenty of scripts that will perform AD operations using the DN, but in this case I need it to look up a user based on their "initials" listed in a CSV and move those users to a different OU.
This is the script I have for doing it with their username but I have no idea if I can just look up the initials field and perform operations based on that instead or if it needs to be a two step process that finds the user, retrieves their DN and performs
the operation on that.
# Specify target OU.
$TargetOU = "ou=NewUsers,ou=West,dc=MyDomain,dc=com"
# Read user sAMAccountNames from csv file (field labeled "Name").
Import-Csv -Path Users.csv | ForEach-Object {
    # Retrieve DN of User.
    $UserDN = (Get-ADUser -Identity $_.Name).distinguishedName
    # Move user to target OU.
    Move-ADObject -Identity $UserDN -TargetPath $TargetOU
}

It's going to be horribly slow if you have to search for each user by initials.  
I'd build a lookup table first, and then work out of that:
$EmpID = @{}
Get-ADUser -Filter * -Properties Initials |
foreach { $EmpID[$_.Initials] = $_.distinguishedname }
# Specify target OU.
$TargetOU = "ou=NewUsers,ou=West,dc=MyDomain,dc=com"
# Read user EmployeeID from csv file ("Initials" in csv)
Import-Csv -Path Users.csv | ForEach-Object {
# Retrieve DN of User.
$UserDN = $EmpID[$_.Initials]
# Move user to target OU.
Move-ADObject -Identity $UserDN -TargetPath $TargetOU
You might want to add a -SearchBase to limit the Get-ADUser if you can.
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "

Similar Messages

  • "Cannot perform operation, connection is closed" with Open MQ 4.4

    I am using Sun MQ 4.4 with Glassfish 2.1.1 on Red Hat 5.7.
    I am able to install glassfish cluster and all the instances are running fine. But, when I try to send a message to a topic, I get following exception
    javax.jms.IllegalStateException: [C4062]: Cannot perform operation, connection is closed.
    at com.sun.messaging.jmq.jmsclient.ConnectionImpl.checkConnectionState(ConnectionImpl.java:2468)
    at com.sun.messaging.jmq.jmsclient.XAConnectionImpl.createSession(XAConnectionImpl.java:105)
    at com.sun.messaging.jms.ra.ConnectionAdapter.createSession(ConnectionAdapter.java:383)
    Following is part of the stateless EJB where I am creating the session.
    @PostConstruct()
    private void init() {
    if (connectionFactory == null) {
    if (log.isTraceEnabled()) log.trace("Connection factory not set. Retrieving from server context.");
    InitialContext ic = new InitialContext();
    connectionFactory = (ConnectionFactory) ic.lookup("jms/testConnectionFactory");
    if (log.isTraceEnabled()) log.trace("Creating JMS connection.");
    connection = connectionFactory.createConnection();
    @WebMethod()
    public void send(){
    Session session = null;
    session = connection.createSession(true, Session.SESSION_TRANSACTED);
    I am trying to install these on a couple of new machines. Same application works on other machines so I am guessing this is a configuartion issue somewhere on these servers.
    My question is what would be a good way to find the cause of this failure.
    I have turned on log level to finest for ejb-container, jms, RA through glassfish Admin console, but no useful information.
    Also, I don't have the name of the servers in DNS yet. I am using IP address for specifying instances.
    Any suggestions ?
    Thanks
    Vineet

    Hi Tom,
    I used the demo/helloworld/helloworldmessage.java sample.
    By the way, I should add that the broker log contains lines like:
    [B1066] Closing [email protected]:2461 because "[B0061]: Client exited without closing connections"
    Is this what one would expect for a connection.close() ?
    It almost seems that this is happening only when the connection is nulled explicitly or the connection object is destroyed.
    One last thing:
    I was led down the garden path. The reason for the server being thread starved was that there were indeed connections not being closed/nulled.
    Thanks in advance,
    Patrice
    Edited by: paubry04 on Sep 13, 2007 8:21 AM

  • MDX Query much slower for users without administrativ rights

    We have a SQL 2012 SP1 with CU9 installed and run a MDX query against a Cube. The Problem is that the query runs very slow for a user without administrativ persmission on the cube. With admin rights it takes 3 seconds and without 30 seconds. I can't find
    any error in the query so maybe someone can pin point me in the right direction.The Role has all reading information it needs.
    This is the Query:
    SELECT NON EMPTY { [Measures].[Blocked Consignment], [Measures].[Consignment in Inspection],
    [Measures].[Restricted Consignment], [Measures].[Unrestricted Consignment] } ON COLUMNS, NON EMPTY
    { ([Date].[Date].[Date].ALLMEMBERS * [Materials].[Part Number].[Part Number].ALLMEMBERS *
    [Materials].[Key].[Key].ALLMEMBERS * [Sold To].[Name].[Name].ALLMEMBERS *
    [Stock Information].[Plant - Storage Location].[Storage Location].ALLMEMBERS * [Non Zero].[Zero Stock Status].[Zero Stock Status].ALLMEMBERS ) }
    ON ROWS
    FROM ( SELECT ( STRTOSET("[Non Zero].[Zero Stock Status].&[No]", CONSTRAINED) )
    ON COLUMNS FROM ( SELECT ( STRTOSET("[Stock Information].[Storage Location].&[1090]", CONSTRAINED) )
    ON COLUMNS FROM ( SELECT ( STRTOSET("[Stock Information].[Plant].&[1090]", CONSTRAINED) )
    ON COLUMNS FROM ( SELECT ( STRTOSET("[Sold To].[Name].[All]", CONSTRAINED) )
    ON COLUMNS FROM [Stock Snapshot]))))
    WHERE ( IIF( STRTOSET("[Stock Information].[Plant].&[1090]", CONSTRAINED).Count = 1, STRTOSET("[Stock Information].[Plant].&[1090]", CONSTRAINED), [Stock Information].[Plant].currentmember ),
    IIF( STRTOSET("[Stock Information].[Storage Location].&[1090]", CONSTRAINED).Count = 1, STRTOSET("[Stock Information].[Storage Location].&[1090]", CONSTRAINED), [Stock Information].[Storage Location].currentmember ) )
    Any one came across this is or is it a bug?

    Can you check which build of SSAS you've got installed? It looks similar to this bug:
    http://support.microsoft.com/kb/2905298/en-us
    Apart from that, if you have used cell security in your role, it would be expected that query performance would be slower for users of that role.
    Chris
    Check out my MS BI blog I also do
    SSAS, PowerPivot, MDX and DAX consultancy
    and run public SQL Server and BI training courses in the UK

  • V40 upgrade.... Music store unable to perform oper...

    HI 
    after i have upgraded to V40.. there has been problem with music store usage. Frequently it displays "Unable to perform operation". I have to restart it and sometimes it works fine... i think it has become too moody after my update.. jokes apart, i really need some fix since i have a hell lot of free music left for download... 
    any thoughts on it?
    also can i use the OVI maps for navigation without getting connected to Internet? i was just curious to know about it.. may be its a noob question but i wanted to clarify and was not sure to create a new post with it 

    Hi....
              I too have the Problem after v40 firmware upgrade...
    I found a solution also....
    In Music Store Go to Options > Advanced Option > Clear Cache
    But the Problem Reappears when Music Store is restarted....
    I can't find a Permanent Solution....

  • Kodo.persistence.ArgumentException: You cannot perform operation persist on...

    Hello,
    I'm doing the following:
    User user = new User("Dave", "[email protected]");
    dao.begin(); // calls entityManager.getTransaction().begin();
    dao.create(user); // calls entityManager.persist(object);
    dao.commit(); // calls entityManager.getTransaction().commit();
    And I get the following stack trace:
    Feb 19, 2006 11:26:12 PM org.springframework.web.servlet.FrameworkServlet
    processRequest
    SEVERE: Could not complete request
    <4|false|4.0.0EA3> kodo.persistence.ArgumentException: You cannot perform
    operation persist on detached object "sofa.model.User@36e7a9". This
    operation only applies to managed objects.
    FailedObject: sofa.model.User@36e7a9
         at kodo.kernel.BrokerImpl.getDetachedException(BrokerImpl.java:2481)
         at kodo.kernel.BrokerImpl.persist(BrokerImpl.java:2426)
         at kodo.kernel.BrokerImpl.persistSafe(BrokerImpl.java:2379)
         at kodo.kernel.BrokerImpl.persist(BrokerImpl.java:2366)
         at kodo.kernel.DelegatingBroker.persist(DelegatingBroker.java:1275)
         at kodo.persistence.EntityManagerImpl.persist(EntityManagerImpl.java:
    519)
         at sofa.jpa.JpaDao.create(JpaDao.java:23)
         at sofa.controller.SignUpController.processFormSubmission
    (SignUpController.java:42)
    ... and so on
    My User class:
    @Entity(access=AccessType.FIELD)
    public class User {
         @Id(generate=GeneratorType.AUTO)
         private Long id;
         private String name;
         private String emailAddress;
         private String password;
         public User(String name, String emailAddress) {
              this.id = System.currentTimeMillis(); // workaround for bug
              this.name = name;
              this.emailAddress = emailAddress;
    ... getters and setters
    Any ideas?
    thanks,
    dave

    The problem is that "id" is auto-generated, but you're initializing it
    to a non-default value. This makes Kodo think that this is an existing
    database object.
    I suggest downloading EA 4 from www.solarmetric.com. It solves previous
    issues with null primary key values, so you should be able to leave "id"
    null and therefore avoid confusing Kodo by initializing "id" yourself.
    (Note, however, that EA 4 implements the public draft of the spec, and
    there have been changes to some annotations.)

  • Created three new users without Apple IDs and they can't log into either of my Macbook Pro or Mac Mini running Mountain Lion.

    I have created three new users without Apple IDs and they can't log into either of my Macbook Pro or Mac Mini running Mountain Lion.  These accounts are for my kids and originally were setup with parental controls and time constraints.  Thinking this was the problem I removed the time constraints, removed the parental controls, deleted and re-added them, and made them standard users.  I have reinstalled, used disk utility to repair permissions, and made them admins.   Any help is appreciated.

    Users don't need Apple ID's. That's not the issue. Have you tried repairing permissions their accounts?
    http://osxdaily.com/2011/11/15/repair-user-permissions-in-mac-os-x-lion/
    Repairing User Permissions in OS X Lion
    You’ll need to reboot to perform this, and then use the same resetpassword utility that is used to change passwords in Lion, but instead choosing a hidden option.
    When you use the Disk Utility app and Repair Permissions — it doesn’t actually repair the permission settings on folders and files in your Home folder where your documents and personal applications reside.
    In Lion, there is an additional Repair Permissions application utility hidden away. This tool is located inside boot Repair Utilities. Here’s how to access it.
    Restart Lion and hold down the Command and R keys.    You will boot into the Repair Utilities screen. On top, in the Menu Bar click the Utilities item then select Terminal.
    In the Terminal window, type resetpassword and hit Return.
    The Password reset utility launches, but you’re not going to reset the password. Instead, click on the icon for your Mac’s hard drive at the top. From the drop-down below it, select the user account where you are having issues.
    At the bottom of the window, you’ll see an area labeled ‘Reset Home Directory Permissions and ACLs’. Click the Reset button there.
    The reset process takes a couple of minutes. When it’s done, quit the programs you’ve opened and restart your Mac. Notice that ‘Spotlight’ starts re-indexing immediately.

  • How to Use 'uid' for AD Users Without Domain Name For User Log in OAM

    How to Use 'uid' for synchronized Active Directory (AD) Users into Oracle Internet Directory (OID) Without Domain Name For User Logins in OIDDAS and OAM
    We successfully integrated OAM 11g with EBS R12.1.3 Now all the AD user id's stored in fnd_users table as [email protected]
    How can we remove @abc.com
    We are using OID 11g and OAM 11g
    Found the similar note for OID 10G: How to Use 'uid' for AD Users Without Domain Name For User Logins in OIDDAS and SSO [ID 580480.1]
    We are in OID 11g.
    Any help on this greatly appreciated.

    I couldn't find any reference that could be helpful -- Please log a SR and see if this is supported and if the steps are available.
    Thanks,
    Hussein

  • Creation of a normal user without admin rights

    Hi,
    I am new to oracle apex. Can you please let me know how to create a normal user without admin rights in oracle apex application.
    Thanks & Regards,
    venkat
    Edited by: 866673 on Jun 17, 2011 9:53 AM

    Welcome to the forum: please read the FAQ and forum sticky threads (if you haven't done so already), and ensure you have updated with your profile with a real handle instead of "866673".
    You'll get a faster, more effective response to your questions by including as much relevant information as possible upfront. This should usually include:
    <li>Full APEX version
    <li>Full DB version and edition
    <li>Web server architecture (EPG, OHS or APEX listener)
    <li>Browser(s)/version(s) used
    <li>Theme
    <li>Templates
    <li>Region type
    (although for your question only the APEX version is necessary).
    Assuming you mean a user who can authenticate to an application that uses Application Express Account Credentials?
    In APEX 4.0:
    1. Go to Home > Application Builder > [Your Application ] > Administration > Create Users and Groups > Create User
    2. Enter the User Identification information.
    3. In the Account Privileges, specify:
    User is a workspace administrator: No
    User is a developer: No
    4. Complete the rest of the form as necessary.

  • I performed a time machine backup without plugging my labtop into a power source. My computer died and all the settings were changed, ie the clock and date were changed back to 2001. So I tried to restore my computer using a previous time machine backup.

    I performed a time machine backup without plugging my labtop into a power source. My computer died and all the settings were changed, ie the clock and date were changed back to 2001. So I tried to restore my computer using a previous time machine backup. (which I now know was wrong). However, when time machine tried to restore it said there was not enough room to do a backup. It seems that it did a half backup because some essential  files such as system profiler are now missing. Can I undo this restore...? What can I do to fix this

    You need to do a full system restore, per Time Machine - Frequently Asked Question #14.
    If that sends a message, please note the exact wording.

  • Performance operations based on Column values in SQL server 2008

    Hi ,
    I have a table which consist of following columns
    ID    Formula              
    Values                 
    DisplayValue
    1                    
    a*b/100       100*12/100    
          null
    2                    
    b*c/100       
    12*4/100              
    null
    I want to perform operation based on column "Values" and save data after operations in new column Name "Display Value" .i.e I want to get the below result . Can anyone please help.
    ID    Formula              
    Values                 
    DisplayValue
    1                    
    a*b/100       100*12/100    
          12
    2                    
    b*c/100       
    12*4/100             
    0.48
    Thanks for the help.
    Regards, Priti A

    Try this,
    create table #mytable (ID int,Formula varchar(10), [Values] varchar(10), DisplayValue decimal(10,4))
    insert into #mytable values(1 ,'a*b/100','100*12/100',null)
    insert into #mytable values(2 ,'b*c/100','12*4/100',null)
    declare @rowcount int=1
    while @rowcount <= (select max(id) from #mytable)
    begin
    declare @expression nvarchar(max)
    select @expression=[values] from #mytable where id = + @rowcount
    declare @sql nvarchar(max)
    set @sql = 'select @result = ' + @expression
    declare @result decimal(10,4)
    exec sp_executesql @sql, N'@result decimal(10,4) output', @result = @result out
    update #mytable set DisplayValue= @result where id = @rowcount
    set @rowcount=@rowcount+1
    end
    select * from #mytable
    Regards, RSingh

  • How to create a new user without any sample objects from any other user?

    Question as the title.
    I had the example dababase installed when I installed the Oracle database.
    Every time, when I create a new user, there will be some example objects coming
    with the new user.
    How can I remove these objects from the new user?
    Or, how can I create a new user without the example objects?
    Thanks in advance.

    I think the easiest way for you would be to use OEM.
    Just locate each object that you want to remove and right click->remove. Don't bother doing this for any indexes as these will be removed when you drop the corresponding tables.
    If you want to try command line through sqlplus then identify the objects you want to remove by selecting from the user_objects view while logged in as this user. This will give you the name and type of object. Then issue the relevant drop command.
    It's probably worth making sure you have a valid backup first, just in case things go wrong!

  • Alternative for HLS HTML streaming trough JW player for users without Flash?

    Hello!
    I am using HLS TS Streaming trough JW player for the largest group of users that have flash for streaming video's.
    Is there an alternative for users without flash?
    Best regards

    I will just summarize myself...
    Adobe media server supports rtmp and HTTP(HLS and HDS)..
    for rtmp streaming the swf running in a Flash player is the standard interface...that flash player may be an activeX control/plugin in your browser or may be a standalone player downloaded from adobe website...Chrome web browser however users a slightly different( PPAPI based) flash player(which is different from Adobe flash player) and is developed and maintained by google.
    For HLS and HDS, you can either use special players(i.e swfs)(Flash based) developed Adobe by Adobe e.g Strobe meida player(Open Source Media Framework Blog | Adobe’s free and open source media playback system) or you can use players like jwplayer(Video Player Download | JW Player Online Video Player)... Incidentally jwplayer has added simultaneous support for playing rtmp streams too(which is reallly good), but i do not have much insight into workings of jwplayer...

  • How to perform operations on table control

    hello experts,
                         will u plz tell me how to perform operations like delete and update on tablecontrol in module pool.
                                thanks in advance,

    Hey Aravind,
    In case you want to delete just from your table control and not from database table, then you can use the commands:
    clear <workarea_name>
    delete <workarea_name>
    for your selected rows.
    And for deleting from database tables also, use:
    Delete from <Database_table_name> where <where_clause>.
    clear <workarea_name>
    delete <workarea_name>
    This will delete both from the table control and database table also.
    Reward if it proved useful to you.
    Regards
    Natasha Garg

  • Designing Java Apps for Users Without a JRE Installed Yet

    Hi, sorry if this post is in the wrong place, but here goes:
    I'm designing a Swing Java application for a client. My client intends to distribute/sell this application.
    I'm concerned because, chances are that at least one of the people he distributes this application to will not have the JRE installed and will thus be unable to run the application.
    Can anyone give me some suggestions on ways I can make my application more convenient for users without the JRE currently installed? Even some kind of error message that would direct the user to the JRE download site would be okay.
    kwikness
    Edited by: kwikness on Dec 2, 2009 5:56 PM

    Use NSIS and package your application with JRE.
    Add your jar files to lib/ext of the JRE package.
    NSIS can create a short cut (desktop/start menu) to launch java class/jar file
    I would not use webstart unless you are sure that clients will have access to the internet, the bandwidth is not an issue and installing the new JRE is allowed (permissions, SLA, etc.)
    Best regards.

  • [INS-06001] Failed to perform operation due to internal driver error

    I'm installing GI 11.2.0.4 on the zone of solaris(SPARC) 11.1.
    Among executed runInstaller, the following error occured when
    "setup" button is pushed for checking SSH connectivity
    on "Secify Cluster Configuration(Step 4 of 9)" section.
    [INS-06001] Failed to perform operation due to internal driver error.
    Additionally, the following was output by a console executed runInstaller.
    # An unexpected error has been detected by HotSpot Virtual Machine:
    #  SIGBUS (0xa) at pc=0xffffffff3df832fc, pid=14407, tid=38
    # Java VM: Java HotSpot(TM) 64-Bit Server VM (1.5.0_51-b10 mixed mode)
    # Problematic frame:
    # C  [libc.so.1+0x832fc]
    # An error report file with more information is saved as hs_err_pid14407.log
    # If you would like to submit a bug report, please visit:
    #   http://java.sun.com/webapps/bugreport/crash.jsp
    Does anyone know the solution for this issue?
    The configuration of the system is the following.
    +--------------------------------------------+
    |         testserver (global zone)           |
    |+------------+                +------------+|
    ||   zone1    |                |   zone2    ||
    ||      +-----|  +----------+  |-----+      ||
    ||      |vnic3|--|etherstub1|--|vnic4|      ||
    ||      +-----|  +----------+  |-----+      ||
    ||            |                |            ||
    ||  +-----+   |                |  +-----+   ||
    ||  |vnic1|   |                |  |vnic2|   ||
    |+------------+                +------------+|
    |      |         +----------+        |       |
    |      +---------|etherstub0|--------+       |
    |                +----------+                |
    |                     |                      |
    |                  +-----+                   |
    +------------------|vnic0|-------------------+
                       +-----+
    zonecfg:kudotest01> export
    create -b
    set brand=solaris
    set zonepath=/zones/kudotest01
    set autoboot=false
    set ip-type=exclusive
    add net
    set configure-allowed-address=true
    set physical=vnic1
    end
    add net
    set configure-allowed-address=true
    set physical=vnic3
    end
    add anet
    set linkname=net0
    set lower-link=auto
    set configure-allowed-address=true
    set link-protection=mac-nospoof
    set mac-address=random
    end
    add device
    set match=/dev/dsk/c0t600144F00010E010379A5491444F0001d0
    end
    zonecfg:kudotest02> export
    create -b
    set brand=solaris
    set zonepath=/zones/kudotest02
    set autoboot=false
    set ip-type=exclusive
    add net
    set configure-allowed-address=true
    set physical=vnic2
    end
    add net
    set configure-allowed-address=true
    set physical=vnic4
    end
    add anet
    set linkname=net0
    set lower-link=auto
    set configure-allowed-address=true
    set link-protection=mac-nospoof
    set mac-address=random
    end
    add device
    set match=/dev/dsk/c0t600144F00010E010379A5491444F0001d0
    end
    zonecfg:kudotest02>
    testserver:~# dladm show-vnic
    LINK                OVER         SPEED  MACADDRESS        MACADDRTYPE       VID
    vnic0               etherstub0   40000  2:8:20:b5:32:c1   random            0
    vnic1               etherstub0   40000  2:8:20:45:a2:af   random            0
    vnic2               etherstub0   40000  2:8:20:86:7e:4e   random            0
    vnic3               etherstub1   40000  2:8:20:8a:96:a    random            0
    vnic4               etherstub1   40000  2:8:20:ef:f3:dd   random            0
    root@kudotest01:~# ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           127.0.0.1/8
    vnic1/v4          static   ok           192.168.120.2/24
    vnic3/privaddr    static   ok           192.169.120.2/24
    lo0/v6            static   ok           ::1/128
    vnic1/v6          addrconf ok           fe80::8:20ff:fe45:a2af/10
    root@kudotest02:~# ipadm show-addr
    ADDROBJ           TYPE     STATE        ADDR
    lo0/v4            static   ok           127.0.0.1/8
    vnic2/v4          static   ok           192.168.120.3/24
    vnic4/privaddr    static   ok           192.169.120.3/24
    lo0/v6            static   ok           ::1/128
    vnic2/v6          addrconf ok           fe80::8:20ff:fe86:7e4e/10

    Please check https://hiteshgondalia.wordpress.com/2012/12/08/ssh-setup-fail-unable-to-find-ssh_host_rsa_key-pub/, Oracle Application DBA: [INS-06001] Failed to perform operation due to internal driver error (During installation of RAC…

Maybe you are looking for

  • Export Universe after renamed it

    Hi! I am using Designer 6.5 and I have imported a universe, saved it with a test-extension and made some changes. Then I renamed it again to the original name and tried to export it. Now I get an errormessage which says that the file-name and the uni

  • Macbook Pro appears to have viruses-How to erase

    My macbook Pro seems to have retained a virus.  I was wondering, what's the best way to erase everything and start over?

  • Sculpture Chime Efx a la Cygnus X-1?

    I am trying to build a solid hammered orchestra chime sound through Sculpture, something one might hear in an orchestra. Might you have suggestions? Or suggestions where or how I can get that type of rich metallic hammered chime? The sound I seek rem

  • HT204266 cannot connect to itunes store when trying to get app updates

    Why do I get this message...."cannot connect to itunes store" when trying to get app updates.  I have no trouble connecting to store in other area.

  • Problem in Result Recording

    Dear Guru, During the production process I am having parallel operations. & All the operation having result recording process. So, I want to make the result recording for different operation simultaneously. So is it possible to make inspection for on