I'm not sure if I can do this, but I'm almost finished with these scripts
for HR's new software package....
I need to update the "manager" attribute, but they are giving me the
display name of the manager, not the samaccountname.
I keep getting Ambiguous Identity, and I can't seem to get it.
This is what I have:
$manager = (get-qaduser displayname -eq $_.manager)
I've tried it the other way as well , (get-qaduser $_.manager displayname),
but that didn't work either.
Can someone point me in the right direction?
Thanks!
Candee
The entire script, for context:
Import-Csv "C:\temp\filesin\user_changes.csv" |foreach{
#Check for preferred first name, if blank, use real first name
$givenName = ''
If( -not [string]::isnullorempty($_.preferredfirstname))
{
$givenname = $_.preferredfirstname
}
else
{
$givenname = $_.firstname
}
#Check for preferred last name, if blank, use real last name
$SN = ''
If( -not [string]::isnullorempty($_.lastnamepreferred))
{
$SN = $_.lastnamepreferred
}
else
{
$sn = $_.lastname
}
$manager = (get-qaduser displayname -eq $_.manager)
$EMPNMR = $_.employeegui
$SAM = $_.MISUSERNAME
set-qaduser $SAM -displayname $displayname `
-givenname $givenname `
-sn $SN `
-company $_.Company `
-department $_.department -title $_.businesscardtitle
-telephonenumber $_.telephone `
-city $_.city -postalcode $_.zip -state $_.state `
-streetaddress $_.street -manager $_.manager `
-oa
@{ipphone=$_.ipphone;mobile=$_.mobile;employeenumber=$_.employeegui}
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1