Solved

Shutting down a room of computers

Posted on 2008-10-27
7
205 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
Independent Software Vendors: 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

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!

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

735 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