w00t! Thanks Michael - that worked! =)
On Tue, Jul 30, 2013 at 12:18 PM, Michael B. Smith <mich...@smithcons.com>wrote: > Change**** > > ** ** > > $manager = get-qaduser $_.manager | select name**** > > ** ** > > To**** > > ** ** > > $manager = (get-qaduser $_.manager).name**** > > ** ** > > *From:* listsad...@lists.myitforum.com [mailto: > listsad...@lists.myitforum.com] *On Behalf Of *Candee > *Sent:* Tuesday, July 30, 2013 12:01 PM > *To:* powershell@lists.myitforum.com > *Subject:* Re: [powershell] Ambiguous Identity**** > > ** ** > > I'm getting closer - thanks for helping..**** > > Here is the snip of script I'm using; I can see it's returning the manager > name, but it's not setting it in the user account.**** > > Any suggestions? > Thanks again!**** > > > $manager = get-qaduser $_.manager | select name > $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} `**** > > **** > > **** > > And the error I'm getting:**** > > **** > > Set-QADUser : Cannot bind parameter 'Manager'. Cannot convert the > "@{Name=cvaglica}" value of type "Selected.Quest.ActiveRoles.ArsPower > ShellSnapIn.Data.ArsUserObject" to type > "Quest.ActiveRoles.ArsPowerShellSnapIn.Data.IdentityParameter". > At C:\TEMP\SCRIPTS\WORKS =)\Epicor_Update_Managers.ps1:59 char:47 > + -streetaddress $_.street -manager <<<< $manager ` > + CategoryInfo : InvalidArgument: (:) [Set-QADUser], > ParameterBindingException > + FullyQualifiedErrorId : > CannotConvertArgumentNoMessage,Quest.ActiveRoles.ArsPowerShellSnapIn.Powershell.Cmdlets.SetUserCmdlet > **** > > ** ** > > On Tue, Jul 30, 2013 at 7:49 AM, Candee <can...@gmail.com> wrote:**** > > Thanks both.**** > > I will try these this morning.**** > > **** > > I think the reason I was getting the ambiguous identity error is because I > need to get the user listed under manager (which is the display name) as > $manager, and then the user listed under user with the account name.**** > > **** > > I have the display name of the manager in the csv, I need to get the > account name for that.**** > > Then I have the account name of the user in the csv, I need to get that > account and then update the manager on that user.**** > > **** > > Does that make sense?**** > > So:**** > > User Manager**** > > candee "last name first name"**** > > **** > > I need to update candee's manager to the user account that matches the > display name.**** > > **** > > ** ** > > On Mon, Jul 29, 2013 at 4:30 PM, Milfajt, Patrice <patrice.milf...@va.gov> > wrote:**** > > Candee,**** > > **** > > I was able to get just the displayname using this, assuming $displayname > is valid:**** > > **** > > $manager = get-qaduser -identity (get-qaduser $displayame | select > manager).manager | select displayname**** > > **** > > Patrice**** > > **** > > *From:* listsad...@lists.myitforum.com [mailto: > listsad...@lists.myitforum.com] *On Behalf Of *Candee**** > > > *Sent:* Monday, July 29, 2013 3:03 PM > *To:* powershell@lists.myitforum.com > *Subject:* [powershell] Ambiguous Identity**** > > **** > > 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 **** > > > ================================================ > Did you know you can also post and find answers on PowerShell in the > forums? > http://www.myitforum.com/forums/default.asp?catApp=1 **** > > ** ** > > > ================================================ > Did you know you can also post and find answers on PowerShell in the > forums? > http://www.myitforum.com/forums/default.asp?catApp=1 **** > > ** ** > > > ================================================ > Did you know you can also post and find answers on PowerShell in the > forums? > http://www.myitforum.com/forums/default.asp?catApp=1 **** > > ================================================ > Did you know you can also post and find answers on PowerShell in the > forums? > http://www.myitforum.com/forums/default.asp?catApp=1 > ================================================ Did you know you can also post and find answers on PowerShell in the forums? http://www.myitforum.com/forums/default.asp?catApp=1