PowerShell Logo Small

Uninstall-ADServiceAccount



This is the built-in help made by Microsoft for the command 'Uninstall-ADServiceAccount', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.

SYNOPSIS

Uninstalls an Active Directory managed service account from a computer or removes a cached group managed service account from a computer.

SYNTAX


Uninstall-ADServiceAccount [-Identity] <ADServiceAccount> [-AuthType {Negotiate | Basic}] [-ForceRemoveLocal] [-Confirm] [-WhatIf] [<CommonParameters>]



Search powershellhelp.space

DESCRIPTION


The Uninstall-ADServiceAccount cmdlet removes an Active Directory standalone managed service account (MSA) on the computer on which the cmdlet is run. For group MSAs, the
cmdlet removes the group MSA from the cache, however, if a service is still using the group MSA and the host has permission to retrieve the password a new cache entry will
be created. The specified MSA must be installed on the computer.


The Identity parameter specifies the Active Directory MSA to uninstall. You can identify a MSA by its distinguished name (DN), GUID, security identifier (SID), or Security
Accounts Manager (SAM) account name. You can also set the parameter to a MSA object variable, such as $<localServiceAccountObject> or pass a MSA object through the pipeline
to the Identity parameter. For example, you can use the Get-ADServiceAccount to get a MSA object and then pass that object through the pipeline to the
Uninstall-ADServiceAccount cmdlet.


For standalone MSA, the ForceRemoveLocal switch parameter will allow you to remove the account from the local LSA without failing the command if an access to a writable DC
is not possible. This is required if you are uninstalling the standalone MSA from a server that is placed in a segmented network (i.e. perimeter network) with access only to
an RODC. If you pass this parameter and the server has access to a writable DC the standalone MSA will be un-linked from the computer account in the directory as well.



<

RELATED LINKS

Online Version: http://go.microsoft.com/fwlink/p/?linkid=291135
Get-ADServiceAccount
Install-ADServiceAccount
New-ADServiceAccount
Remove-ADServiceAccount
Set-ADServiceAccount

REMARKS

<

Examples


-------------------------- EXAMPLE 1 --------------------------

PS C:\>Uninstall-ADServiceAccount -Identity SQL-SRV1



This command uninstalls the managed service account SQL-SRV1 from the local machine.




-------------------------- EXAMPLE 2 --------------------------

PS C:\>Uninstall-ADServiceAccount -Identity sql-hr-01 -ForceRemoveLocal



This command uninstalls a standalone Managed Service Account from a server located in a RODC-only site with no access to writable DCs such as a perimeter network.