Link to home
Start Free TrialLog in
Avatar of JCJohnson76
JCJohnson76

asked on

Bulk computer reset

Hello,

 I will like to bulk reset computer accounts in AD.  The goal is to try and break domain trust relationship with a bunch of computers.  I would like to user Powershell and import-csv  to carry out this task.   Can someone provide me the syntax for this.
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Or you can use DSMOD
dsmod computer <ComputerDN> -reset

Open in new window

Or Powershell. Computers.txt contains a list of computers without a header
Get-Content "C:\temp\computers.txt";foreach($computer in $computers){Reset-ComputerMachinePassword -server $computer}

Open in new window

Avatar of JCJohnson76
JCJohnson76

ASKER

dsmod is fine also but how do u use bulk import with dsmod;

Also will disable-adcomputer do the same;
did not work
I revamp the script to

$Computers = Get-Content "C:\scripts\Reset-Computers\Input\Computers.txt"
foreach($computer in $computers){Reset-ComputerMachinePassword -server $computer}

Received the error message

Cannot reset the secure channel password for the computer account in the domain. Operation failed with the following exception:  The server is not operational
how can I use the dsmod command using the foreach loop alongside the invoke-command
ASKER CERTIFIED SOLUTION
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial