Remove a PC object from a domain in WinPE with Powershell

Remove a PC object from a domain in WinPE with Powershell

This code i made to be able to make a cleanup task for PC’s no longer in use. This script remove computers from domain when running WinPE.
This was one of the steps that was done. Another step deleted objects in McAfee EPO and SCCM.
To be able to delete a PC within a domain from a non-domain PC you need to install ADSI on the WinPE image.

You need this in order to make it work:
1. ADSI WinPE implementation: ADSI implementation in WinPE
2. You need a user with the right privileges on the AD server. The username should be provided with the domain name like this: “domain\username”
3. IP adresse to the AD server.

2 thoughts on “Remove a PC object from a domain in WinPE with Powershell”

    • Hi Goutham
      The script makes use of ADSI to connect to a given AD server and deletes a PC object.
      Is there any specific parts of the script that you want explained or do you need an example on how to use it?
      /Morten

Leave a comment