Solved

Shutting down a room of computers

Posted on 2008-10-27
7
185 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
  • 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

947 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now