Re: Remote Shutdown Batch Issue

From: Richard C. (richard_at_ccommconsulting.com)
Date: 11/14/04


Date: Sun, 14 Nov 2004 13:29:44 -0500

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" <Cyberaccount72@yahoo.com> wrote in message
news:%23kP55DnyEHA.3588@TK2MSFTNGP14.phx.gbl...
> 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." <richard@ccommconsulting.com> wrote in message
> news:OJnzcrdyEHA.2040@tk2msftngp13.phx.gbl...
>>
>> "Dave Leonardi" <Cyberaccount72@yahoo.com> wrote in message
>> news:e752EKdyEHA.2516@TK2MSFTNGP10.phx.gbl...
>> > 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
>> >
>>
>> 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...
>>
>>
>
>



Relevant Pages

  • Re: Remote Shutdown Batch Issue
    ... Sorry for being script stupid. ... As for SUS I apoloigize; ... > Dim WshX ... When are patches ...
    (microsoft.public.windows.server.scripting)
  • RE: export user accounts from NT 4.0 domain
    ... ATTENTION THE SCRIPT MUST BE RUNNED FROM A COMPUTER WHERE EXCEL IS ... from the information in a Microsoft Excel spreadsheet. ... Dim strLast, strFirst, strMiddle, strPW, intRow, intCol ... On Error GoTo 0 ...
    (microsoft.public.windows.server.scripting)
  • Re: Password Expire
    ... We have one fron end Edge server in our DMZ which passes email onto two ... I used to schedule a script to run every 24 hours on my Exchange 2003 ... Dim fso, txtarray, BodyText ... Call ProcessFolder (objContainer, numDays) ...
    (microsoft.public.exchange.admin)
  • Array Trouble
    ... exist and write the results to an array which can be subsequently ... The script seems to run but there is no output. ... Dim rline() ... Dim msg ...
    (microsoft.public.scripting.wsh)
  • Re: LDAP query information
    ... a "Dim" statement. ... execution of the script. ... ' Filter on computer object. ... ' Construct LDAP syntax query. ...
    (microsoft.public.windows.server.scripting)