This function is part of my AADSites module, which can be downloaded here . For more info on the module see here . Remove-AADsitelink has to deal with sites still being members of the sitelink. If you have sites associated to the sitelink, remove-AADsitelink will warn you as such but offer -force:$true as an override The -confirm:$false switch is availale to supress the confirm prompt. NAME Remove-AADsitelink SYNOPSIS Removes the AD sitelink object that matches the name supplied SYNTAX Remove-AADsitelink [-Identity] [[-force] ] [[-confirm] ] [ ] DESCRIPTION Removes the AD sitelink object, if one exists, that matches the name given If there are sites configured as part of the sitelink, the command requires -force:$true option to remove the site Returns True if the the site has been removed, False if not. PARAMETERS -Identity Mandatory - The name of the object you want to remove. Position 0. -force Optional - Set to true if you want to ignore war...
Powershell for Active Directory