You may need quotes to deal with the spaces:

"$($manager)"

I am not sure. I am not familiar with the commandlet you are using. I usually 
just use .Net objects or system objects to do things in powershell. I need to 
download some PS management packs I guess!


From: listsad...@lists.myitforum.com [mailto:listsad...@lists.myitforum.com] On 
Behalf Of Candee
Sent: Monday, July 29, 2013 4:28 PM
To: powershell@lists.myitforum.com
Subject: Re: [powershell] Ambiguous Identity

Yes; sorry - it's been a long day.
I also tried different iterations.
The error I get from this one is that
A positional parameter cannot be found that accepts argument 'Mouse Mickey'.
Thanks!

On Mon, Jul 29, 2013 at 4:21 PM, Kelley, Matthew 
<kelle...@med.umich.edu<mailto:kelle...@med.umich.edu>> wrote:
Did you try to change this line to use the variable you set:

From:
-streetaddress $_.street  -manager $_.manager `

To:
-streetaddress $_.street  -manager $manager `

From: listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com> 
[mailto:listsad...@lists.myitforum.com<mailto:listsad...@lists.myitforum.com>] 
On Behalf Of Candee
Sent: Monday, July 29, 2013 4:03 PM
To: powershell@lists.myitforum.com<mailto: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

**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be 
used for urgent or sensitive issues

================================================
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
**********************************************************
Electronic Mail is not secure, may not be read every day, and should not be 
used for urgent or sensitive issues 


================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1

Reply via email to