Discussion Locked

A Script to shutdown all the computers automatical after updating Antivirus

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

HI

I have a small question. I work in a small organization and we have an antivirus program that will be running on all the systems on the network on friday. Is there a way that we can run a script from the server so that all the computers shutdown after they are updated on friday instead of manually shutting the computers off.

Thanks in advance

5 replies

by cmiller5400

Unless the a/v program can launch a process after a certain action, then the only way I know of is to schedule it with the task scheduler.

by dawgit

It depends on the AV software. Some software packages have this funtion built in. You have to check the options on the your AV software. The actual AV software will be the only program that will know when it's scan is completed. There are too many variables in the scan time, or even up-date times from computer to computer. Part of the delivery package should be 'Shut down when complete'. -d

by nicknielsen

When the AV update completes, it will hand control back to the original script which can then call the shutdown script.

by dawgit

I was wondering if / how that could be done. How would the script work for the different computers /times? I have an idea, but I'm sure not sure on it. That would be a good Blog or post in it's self. (hint-hint) -d

by nicknielsen

Don't really need to run a second script, either. Determine what MS-DOS error code (%onerror%) the AV returns when it completes the update, and:

IF "%onerror%"=="0" c:\windows\system32\shutdown.exe -s -f -t 10

Substitute the appropriate error code for the "0" in the conditional. This might be easier to do in a VB script, but I don't know. I think the most difficult thing here will be determining the error code returned by the AV program when it completes the update.

It would have to run locally, however, and the OP did mention a remote run. If the original script takes the computer name as a variable it might work like this from a remote server:

IF "%onerror%"=="0" %computername%\c\windows\system32\shutdown.exe -s -f -m %computername% -t 10

It's been a long time, Dawg! I'm amazed I remember this much.

Edit: corrected syntax

This discussion is closed to new replies.