Hello, I have a script that worked from my Windows 7 machine, but when I attempted to run the script as a standalone test on Server 2008 R2 I received the following error:
Move-ADObject : Access is denied
At C:\scripts_new\tombstoned.ps1:5 char:14
+ Move-ADObject <<<< -Identity $account.distinguishedName -TargetPath $TargetO
+ CategoryInfo : PermissionDenied: (CN=XXXXXX,OU=XXXXXX,DC=XXXXXX,DC=XXXXXX:ADObject) [Move-ADObject], UnauthorizedAccessException
+ FullyQualifiedErrorId : Access is denied,Microsoft.ActiveDirectory.Manag
This shows up for each account it's attempting to move, but most are already in the desired OU. There's one user account I'm working on that does not get moved, even though it's disabled.
I've searched various parts of the error, but had no resolution. I also installed KB2806748, which is supposed to address this issue and no success either.
Any ideas on how to get past the access denied message? My ultimate goal is to have it run as a weekly job under scheduled tasks.