Solved

Shutting down a room of computers

Posted on 2008-10-27
7
212 Views
Last Modified: 2010-04-23
I'm trying to remotely shutdown a room of computers, for this example i'll call the room BB. All the computers are named BB-01 to BB-20. I've tried a few scripts i've found but they just dont seem to do anything.

The last one i tried was:
[code] Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim NumComp As String = "01"
        Shell("shutdown.exe -r -m \\BB-" & NumComp & " -t 60 -c ""This workstation will restart in 60 seconds, please save any work.""")
    End Sub

End Class [/code]

Is there something special i need to do? Do i need to authenticate?

Thanks.
0
Comment
Question by:alumwell
[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
  • 5
7 Comments
 
LVL 16

Expert Comment

by:JoWickerman
ID: 22811888
Hi alumwell,

I'm not a developer, but I know that only a domain administrator may send a shutdown command to a PC connected to a domain.

Cheers.
0
 
LVL 3

Expert Comment

by:Darksied9
ID: 22811899
If these are all Active Directory Members, which I hope, then set the script authenticate as a user that has permissions to kill a PC, which a standard "Everyone" member does not.  Even if you run the script as an administrator, you are calling another shell command that probably won't pass that authentication on...not 100% on that though.  If I were going to do this I would simply put the following command as many times as needed (I am assuming by hard coding the BB your PCs are pretty much going to remain the same) in a CMD and execute the CMD as an admin.

Not as pretty as VB, but...
shutdown.exe -r -m \\BB-01 -t 60 -c "This workstation will restart in 60 seconds, please save any work."
shutdown.exe -r -m \\BB-02 -t 60 -c "This workstation will restart in 60 seconds, please save any work."
shutdown.exe -r -m \\BB-03 -t 60 -c "This workstation will restart in 60 seconds, please save any work."

Open in new window

0
 
LVL 3

Accepted Solution

by:
Darksied9 earned 500 total points
ID: 22811993
Actually, if you really want to do this quick and dirty, put all the file names in a shutdown.txt file and the put the attached script in the command shell...

May have to add:

-u user
-p Pass

for authentication, but I don't think so if the executing user has permissions.

This will execute psshutdown ( http://download.sysinternals.com/Files/PsTools.zip ) -- Microsoft owns it now :(  but it should work.
c:\psshutdown.exe @file.txt -t 60 -f -k -m "This PC Will Blow Up In 60 Seconds!  Run You Fool!"

Open in new window

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Expert Comment

by:Darksied9
ID: 22812000
Oops... That should be:
c:\psshutdown.exe @shutdown.txt -t 60 -f -k -m "This PC Will Blow Up In 60 Seconds!  Run You Fool!"

Open in new window

0
 
LVL 3

Expert Comment

by:Darksied9
ID: 22812037
On a small side note, it does not have to be a Domain Admin:

On workstations and servers: Administrators (Anyone in the Local Administrators - Enterprise Admins, Domain Admins are granted this by default).
On domain controllers: Administrators, Server Operators.
0
 

Author Closing Comment

by:alumwell
ID: 31510263
Thanks. It works. Just got to get it into a script now. Thanks again.
0
 
LVL 3

Expert Comment

by:Darksied9
ID: 22812896
No problem.  Glad to help.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

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