Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Batch Script to shutdown network PCs

Posted on 2014-01-27
2
Medium Priority
?
1,128 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 800 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 800 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

Uncontrolled local administrators groups within any organization pose a huge security risk. Because these groups are locally managed it becomes difficult to audit and maintain them.
A bad practice commonly found during an account life cycle is to set its password to an initial, insecure password. The Password Reset Tool was developed to make the password reset process easier and more secure.
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

705 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