Delete an AD user using Quest cmdlets

From MyWiki
Jump to: navigation, search
Remove-QADObject
 
Delete a user account, group or other object from Active Directory.
 
Syntax
      Remove-QADObject [[-Identity] IdentityParameter]
	      [-DeleteTree] [-Force] [-Proxy] 
             [-WhatIf] [-Confirm] Advanced_Options
 
Key
 
   -identity    The Distinguished Name (DN), Canonical Name, GUID or, where applicable,
                the Domain\Name, UPN or SID of the user object you wish to disable. 
 
   -DeleteTree  Delete the specified object along with all of its descendant objects.
                Without this parameter, Remove-QADObject will fail to delete any
                container object that holds any child objects.
 
   -Force       Override any restrictions that prevent the command from succeeding.
                Useful when running the command in a script
 
   -WhatIf      Describe what would happen if you executed the command,
                without actually executing the command.
 
   -Confirm     Prompt for confirmation before executing the command.
 
   Advanced_Options:
                [-UseGlobalCatalog] [-Proxy] [-Service String]
                [-ConnectionAccount String] [-ConnectionPassword SecureString]
                [-Credential PSCredential] [-Connection ArsConnection]
 
Notes:
By default Remove-QADObject will connect to any available domain controller with the credentials of the locally logged on user, to connect to a specific domain controller using a specific account, either use the advanced options (-Proxy/-Service/-ConnectionAccount) or use the Connect-QADService cmdlet to make the connection.
 
Example
 
Remove the user account JaneC in domain ss64Dom
 
PS C:> remove-QADObject 'ss64Dom\JaneC'
 
Delete all the user objects located in a specific container:
 
PS C:> get-QADUser -searchRoot 'ss64Dom.ss64.com/testOU' | remove-QADObject -confirm