AdComputer Shutdown Scripts

Hi Guys I have an issue I'm trying to import all the machines on Active directory on a csv file which I have done. The main issue is that I need to create a PowerShell script that shutdown all of the machines that are on the CSV file.

I have completed the part where I have exported all the machines on csv file. Now I need a Powershell script that will shutdown all the machines on csv file.


January 28th, 2015 12:41pm

Depends on what you have in your CSV file. But assuming the column header for the list of computers is "ComputerName" then this should do what you want:

$ListOfComputers = Import-Csv ".\computers.csv" | Select-Object -ExpandProperty ComputerName
Stop-Computer -ComputerName $ListOfComputers

  • Proposed as answer by jrv Wednesday, January 28, 2015 3:49 PM
  • Marked as answer by Bill_StewartModerator Friday, January 30, 2015 2:18 PM
Free Windows Admin Tool Kit Click here and download it now
January 28th, 2015 5:25pm

Big Ups it worked thanks a lot my apologies for the late reply.
  • Marked as answer by Lelethu Friday, January 30, 2015 11:48 AM
  • Unmarked as answer by Bill_StewartModerator Friday, January 30, 2015 2:18 PM
January 30th, 2015 2:47pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics