Set-ADObject error in PowerShell -


i created script copy existing user when new 1 starts.

i went on leave 2 weeks, come , not working - , no-ones touched script

get-aduser -ldapfilter "(userprincipalname=copy_me@test.com)" -properties description, physicaldeliveryofficename, streetaddress, postofficebox, state, st, l, postalcode, co, c, pager, department, company, manager, memberof | foreach-object {set-adobject -identity "cn=new user,ou=our-users,dc=test,dc=com" -replace @{description="$($_.description)";physicaldeliveryofficename="$($_.physicaldeliveryofficename)"; streetaddress="$($_.streetaddress)"; postofficebox="$($_.postofficebox)"; st="$($_.st)"; l="$($_.l)"; postalcode="$($_.postalcode)"; co="$($_.co)"; c="$($_.c)"; pager="$($_.pager)"; department="$($_.department)"; company="$($_.company)"; manager="$($_.manager)"; othertelephone=" 8823"}}  

the error powershell shows is:

    set-adobject : replace @ c:\windows\system32\windowspowershell\v1.0\user-process\copy-user.ps1:2 char:271 + get-aduser -ldapfilter "(userprincipalname=copy_me@test.com)"  -properties description, physicaldeliveryofficename, streetaddress, postoffice box, state, st, l, postalcode, co, c, pager, department, company, manager, memb erof | foreach-object {set-adobject <<<<  -identity "cn=new user,ou=our-users,dc=test,dc=com" -replace @{description="$($_.d escription)";physicaldeliveryofficename="$($_.physicaldeliveryofficename)"; str eetaddress="$($_.streetaddress)"; postofficebox="$($_.postofficebox)"; st="$($_ .st)"; l="$($_.l)"; postalcode="$($_.postalcode)"; co="$($_.co)"; c="$($_.c)"; pager="$($_.pager)"; department="$($_.department)"; company="$($_.company)"; ma nager="$($_.manager)"; othertelephone=" 8823"}}     + categoryinfo          : invalidoperation: (cn=test user...,dc=test,d    c=com:adobject) [set-adobject], adinvalidoperationexception     + fullyqualifiederrorid : replace,microsoft.activedirectory.management.com    mands.setadobject 

your posted error seems ambiguous:

 foreach-object {set-adobject <<<<  -identity "cn=new user, 

is displayed script line error, , agrees posted script, error message showing:

+ categoryinfo          : invalidoperation: (cn=test user..., 

where getting "test user" from?


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -