Solved

Batch Script to shutdown network PCs

Posted on 2014-01-27
2
1,090 Views
Last Modified: 2014-02-08
Hi  

I am in a process of choosing a Network PC shutdown software. Meanwhile

I want to run a batch file from my windows 7 PC , so that it can shutdown the chosen network PCs.

If the script cant find the PC It should ignore that PC and shut down the remaining alive PCs.Plaese post me the syntax to do this.

Any help will be grateful.

Many thanks
0
Comment
Question by:lianne143
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 29

Assisted Solution

by:becraig
becraig earned 200 total points
ID: 39812934
Quick powershell

You need a text file with the list of servers:

$servers = (gc serverlist.txt)
foreach ($server in $servers) 
{while (Test-Connection -computername $Server) {shutdown -r -f -m $server -c "Whatever your reason is for shutdown" }

 }

Open in new window


The -r indicates reboot (Since I doubt you want to keep them switched off)
You can remove it if you only want to shutdown.
0
 
LVL 3

Accepted Solution

by:
SandyWalve earned 200 total points
ID: 39814428
List all the Servers in a Notepad one after the other and save it on your PC from where you can execute this command.

You need to first download PSEXEC. I am assuming you having Local Admin access to all the PC with same account which you are using to execute the command.

psexec @ServerList.txt "shutdown /s"

PSEXEC to download

http://technet.microsoft.com/en-in/sysinternals/bb897553.aspx
0

Featured Post

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article runs through the process of deploying a single EXE application selectively to a group of user.
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question