header1   header
header
header Register : : Login header
header
connector   connector
menuleft menuright
submenu   submenu
left
Searching AD
Last Post 03 Sep 2010 05:30 AM by uSlackr. 0 Replies.
Printer Friendly
  •  
  •  
  •  
  •  
  •  
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
uSlackrUser is Offline
New Member
New Member
Posts:68
Avatar

--
03 Sep 2010 05:30 AM
    Good morning all.  I spent a bit of time last night writing my first real PoSH script to update our AD from a csv export from Peoplesoft.  A couple things came up.  Thought you all might help.

    I read the csv into a variable then pipe it though foreach to process each line of the csv.  One of the fields is the employeeID which I use to search AD.  This snippet shows this:

    $PSInfocsv = import-csv $PSInfoFile
    $PSinfocsv | foreach { 
             $EmpInfo = $_ 
             $Empinfo.EmplID 
             $EmpAD = get-aduser -Filter{employeeId -eq $Empinfo.EmplID } 
        ...
    }

    The get-aduser fails with the error:
    Property: 'EmplID' not found in object of type: 'System.Management.Automation.PSCustomObject'.

    If I save the value of $EmpInfo.emplID to a variable and use the variable in the query this seems to work.  I'm guessing by doing so I am casting this as a string.  Am I close?

    \\Greg
    \\uSlackr
    You are not authorized to post a reply.


    Active Forums 4.3
    right
    footer   footer
    footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2 footer
    footer   footer