I'm using Powershell to play around with Active Directory and, though I can get stuff out, I'm having troubles making changes.
I don't think it's a permissions problem since I'm not actually seeing an error with the test entry that was set up for me, something I do see if I try to change a different entry.
I'm using psexec (since runas has no command-line password parameter) to run Powershell as a different domain user, since my own account doesn't have rights to change AD. Executing whoami within Powershell confirms I'm running as the correct user.
What I'm doing basically boils down to:
PS C:\Temp> get-aduser -identity Xyzzy.Test -properties surname
DistinguishedName : CN=Xyzzy Test,OU=Users,DC=company,DC=com
Enabled : True
GivenName : Xyzzy
Name : Xyzzy Test
ObjectClass : user
ObjectGUID : b1d2a3ff-3ee4-56b7-bc89-12ad345678a9
SamAccountName : Xyzzy.Test
SID : S-1-5-21-9999999999-888888888-77777777-66666
Surname : Test
UserPrincipalName : [email protected]
PS C:\Temp> set-aduser -identity Xyzzy.Test -surname "xyzzy"
Then, when I again run the same get-aduser, I find the surname hasn't changed at all.
It seems to be failing silently since there is no error produced by the set-aduser.
What could cause this to not work yet not report an error?
$cred=get-credential; Start-Process powershell.exe -Credential $cred -ArgumentList "-file c:\temp\script.ps1"- Loïc MICHEL-surname [string]"xyzzy"- ATek