Installing “agent” on Windows 10/11 PC after doing factory reset using powershell without user inter

Copper Contributor
  • I am looking for a single powershell script to perform following two tasks:
    -Reset windows to factory default state, deleting all user/application data
    -After reset, run another PowerShell script, which we can use to install an agent do config etc.


    I have come across following link and found a useful script (written in reply from “dretzer”).


    After I ran the script on my windows 11 PC, it reset the windows to factory default removing all the users’ accounts/data.


    Now I need to implement this additional functionality into this reset script:
    -After completion of windows reset process, a second powershell script (to install an agent) runs automatically on the same PC


    Does anyone know how to achieve this?

1 Reply


Hello everyone

I have found a solution to this problem.

For this we need to make an unattend.xml file and add powershell script to it. This will do all the work. Just restart windows and everything will be done automatically without user interaction including OOBE, setting username and password and installation of any software.