The script could be as follow:
$PCList = Import-Csv -Path .\ComputerList.csv
foreach ($PC in $PCList )
{
Stop-Computer -ComputerName. -$PC.ComputerName -Force
}
Let me know if that work as expected.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hi, I would need help to write a bat file to shutdown all the computers listed in the text file. Can someone help me please?
This script will extract the list of computers name from the text file and loop to shutdown each computer.
This answer has been deleted due to a violation of our Code of Conduct. The answer was manually reported or identified through automated detection before action was taken. Please refer to our Code of Conduct for more information.
Comments have been turned off. Learn more
The script could be as follow:
$PCList = Import-Csv -Path .\ComputerList.csv
foreach ($PC in $PCList )
{
Stop-Computer -ComputerName. -$PC.ComputerName -Force
}
Let me know if that work as expected.