Hi,
i am struggling with a apparently easy task: Changing all entries in ad-accounts with Homedir beginning with \oldserver.. to \newserver.…
This is what I expect to work:
get-aduser -Filter { SamAccountName -like "seppl" } -SearchBase "OU=some, OU=entries, DC=here, DC=local" -Properties HomeDirectory | Where-Object { $_.HomeDirectory -like "\\oldserver\user\*" } | set-aduser -HomeDirectory $($_.HomeDirectory -replace 'oldserver', 'newserver')
But it doesn’t. Errormessage is:
set-aduser : replace
In Zeile:3 Zeichen:1
- set-aduser -HomeDirectory $($_.HomeDirectory -replace ‘oldserver’, ‘newserver’)
-
+ CategoryInfo : InvalidOperation: (CN=someone...,DC=local:ADUser) [Set-ADUser], ADInvalidOperationException + FullyQualifiedErrorId : ActiveDirectoryServer:0,Microsoft.ActiveDirectory.Management.Commands.SetADUser
All tipps from you are highly appreciated, since I have no clue what’s wrong.
Thank you very much!
Alex