Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Remote Shutdown Batch Issue

0 views
Skip to first unread message

Dave Leonardi

unread,
Nov 13, 2004, 5:45:43 PM11/13/04
to
Good Afternoon,

I had a question dealing with automating a remote shutdown for my 200
end-users. The problem is that they are leaving their workstations on after
hours(or Longer) and SUS patches and updates are not getting to them in the
morning. I initially wanted to have a scheduled task run on my server which
called on a batch to shut down all the remote workstations in the list I
created. The problem is I don't know how to properly code the batch so it
calls on a list.txt of computers. I was offered advice to use JSINC.com Tip
4195, but the solution there offers to shut down all computers in my domain.
I need to be able to modify the list so I can shut down only relevant
computers, not all of them. I was looking around for DOS commands, but am
unable to find an effective answer. I was also contemplating running
scheduled tasks, but I am running W2K and XP Workstations. I guess it would
be easier to centralize the shutdown process on one server, batch file
containing < Shutdown -m \\remotecomputer -s> as opposed to dealing with two
task scheduler utilities and no shutdown.exe on Windows 2000. I'd appreciate
it if someone could give me a hand with this problem it has become quite
frustrating. I ultimately just want to automate the task of shutting down
selected workstations for my domain. I am running W3K/W2K Servers and W2K,
XP Pro workstations. Thank you again.


Regards,

Dave Leonardi


Richard C.

unread,
Nov 13, 2004, 6:44:08 PM11/13/04
to

"Dave Leonardi" <Cyberac...@yahoo.com> wrote in message
news:e752EKdy...@TK2MSFTNGP10.phx.gbl...

Here's what I do on my home LAN to force my kids off their computers after
hours. Its run as a scheduled task at midnight. Basically it loops through
an array of computer names and shuts them down. Also if there is an error
of some sort it writes an event into the App event log of sorts.

'==============================================
Dim Wsh
Set Wsh = CreateObject("Wscript.Shell")
Dim WshX
'One option is to create an array like this
Dim aComputers(4)
aComputers(0) = "PC1"
aComputers(1) = "PC2"
aComputers(2) = "PC3"
aComputers(3) = "PC4"
'Another option is to create an array using the Array() function
'Dim aComputers
'aComputers = Array("PC1","PC2","PC3")
Dim sJob
Dim i
For i = 0 To UBound(aComputers,1)
If aComputers(i) <> "" Then
'You can modify the shutdown options as you need
sJob = "shutdown -m \\" & aComputers(i) & " -s -f -t 300 -c " &_
" ""Your logon hours have expired. " & vbCrLf &_
" You have 5 minutes before shutdown..."" "
Set WshX = Wsh.Exec(sJob)
Do While WshX.Status = 0
Wscript.Sleep 10
Loop
Dim msg
msg = WshX.StdOut.ReadAll & vbCrLf & WshX.StdErr.ReadAll
If WshX.ExitCode <> 0 Then
Wsh.LogEvent 1,msg
End If
End If
Next

'=============================================

Now you did mention SUS is a part of this picture. What are your Autoupdate
policies? Are you using GPO's to enforce the settings? When are patches
scheduled to install?
Perhaps all you really need to do is just adjust your policies?

FYI, we have a mix of 1,000 PCs that can either be on or off after hours so
we decided that the policy for Autoupdates is set to install patches at 4pm
and to give the users the option to reboot if the patches require it. This
allows the user to finish off what they are doing and to shut down as they
would normally or to postpone a shutdown if they need to leave their PC on
overnight to finish running some task that the computer needs to do. It has
taken some 'user education' about rebooting their PC after patches have run
and at their earliest convenience.

At another place of work (much smaller < 50 PCs) the users were trained to
leave their PCs on at night and the Autoupdate policy was set to install
patches at 3am and reboot if needed.

This was the least inconvenient for them.

My main point being that 'user education' is an important part of any patch
management strategy.

HTH

Richard C...


Dave Leonardi

unread,
Nov 14, 2004, 12:40:00 PM11/14/04
to
Rich,

I am really not to familiar with WSH Scripting or Visual Basic. How
would I create your script to run (What editor and File extension to use)
Sorry for being script stupid. As for SUS I apoloigize; I shouldn't have put
the main emphasize on SUS. SUS is autoupdating at update at 6:00 am and yes
I am using GP's, and everything is confiugured properly. I'd like to have
them shut down for other reasons, primarily Computer based GP's. I would
like the end users to shut down regardless, but there are still a few repeat
offenders. I would like to ask one more important question. Could you give
any suggestions or reccomendations on how to approach learning WSH Scripting
(Pre-Requistes and basics)?. I think It could benefit me to learn WSH or
some other form of scripting. Thanks rich I appreciate it.


Dave
Leonardi

"Richard C." <ric...@ccommconsulting.com> wrote in message
news:OJnzcrdy...@tk2msftngp13.phx.gbl...

Richard C.

unread,
Nov 14, 2004, 1:29:44 PM11/14/04
to
Hi David,

You can use any text editor you wish for coding your scripts. My personal
favorite is UltraEdit.
There are plenty of VBScript tutorials on the net, just google...
http://www.google.com/search?client=lgtech-kb&hl=en&q=%2Bvbscript+%2Btutorial
Also, MS's Scripting site is a must for bookmarking...
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/scriptinga.asp
Keep hanging out here in this group and read everything, hopefully it will
sink in. The regulars are great at helping you help yourself. If you try
and need help they will help.
You are correct, learning to script is a valuable, marketable asset to have
which will give you an edge over others that don't know how to script.

Ok for the script... Just save the code in a text file with the extension
.vbs.

HTH

Richard...

"Dave Leonardi" <Cyberac...@yahoo.com> wrote in message

news:%23kP55Dn...@TK2MSFTNGP14.phx.gbl...

Dave Leonardi

unread,
Nov 14, 2004, 2:14:20 PM11/14/04
to
Richard,

I would like to thank you for all your advice. I agree with you a 100%
when it comes to making yourself marketable and not to mention it
facilitates my job. I assure you I will pursue scripting in the future and I
will check back with this newsgroup for further reference and scenarios.
Again thank you for your time and help. It's been a pleasure discussing this
with you.

David Leonardi


"Richard C." <ric...@ccommconsulting.com> wrote in message

news:erVLcgn...@TK2MSFTNGP12.phx.gbl...

0 new messages