PowerShell scripts – delete computer account in Active Directory
$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = $dom.GetDirectoryEntry()
$search = [System.DirectoryServices.DirectorySearcher]$root
$search.filter = "(&(objectclass=computer)(name=windowsserver))"
$search.findall() | %{$_.GetDirectoryEntry() } | %{$_.DeleteObject(0)}
Comments
Anonymous
January 01, 2003
According to you question please refer to the below article blogs.technet.com/.../powershell-command-to-create-computer-account-in-active-directory.aspxAnonymous
May 03, 2011
Now, how about adding a computer account to AD and setting properties like sAMAccountName and Description?