Solved

Shutting down a room of computers

Posted on 2008-10-27
7
177 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

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 …
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 …
This video discusses moving either the default database or any database to a new volume.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 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

8 Experts available now in Live!

Get 1:1 Help Now