Powershell disable ad user

broken image

Using a nested pipeline you could simplify the expression. Although this is still a bit to type, and assumes you know the target distinguished name off the top of your head.

broken image

Yes, the Move-ADObject cmdlet supports –WhatIf so you can verify your syntax before committing. What if: Performing the operation 'Move' on target 'CN=Al Fredo,OU=Sales,OU=Sales and Marketing,OU=Departments,OU=Employees,DC=GLOBOMANTICS,DC=local'.

PS C:\> get-aduser afredo | move-adobject -targetpath 'ou=executive,ou=employees,dc=globomantics,dc=local' -whatif Looking at help and examples you discover all you really need, is to specify the distinguished name of the target OU. The cmdlet to use is a more generic Move-ADObject. PS C:\> get-command -module ActiveDirectory -verb moveĬmdlet Move-ADDirectoryServer ActiveDirectoryĬmdlet Move-ADDirectoryServerOperationMasterRole ActiveDirectory Sadly, the former doesn’t work and you won’t find the latter.

broken image

You might try looking for help using Set-ADUser or Move-ADUser. You can see in the user’s distinguished name where his user account currently resides.