I am putting together a script to run post-sysprep.
It should check if the machine is on the network, and if it is then it should query AD to see if a computer account exists with it's service tag (we're using these as the hostnames of the machines.)
If it does exist, it should delete the account and rejoin the machine to the domain.
I have got the majority of the script running, but need to run the following:
Remove-ADComputer -Identity $distinguishedName
How can I run this from the "standard" powershell environment? I don't want to use the AD module.
(By the way - I'm on a mixed mode 2000/03 domain as we are in the process of upgrading to 2008)
I'm new to PowerShell so be gentle if I'm completely missing the point!