Restart PC at start of Action

(imported topic written by herrm91)

Is there a way to restart the machine at the start of an action then have the action complete once restarted?

I have a application package that occassionally restarts the workstation prior to installing. The issue is it doesn’t start the installation automatically once restarted. I would like always restart the workstation and have the install kick off immediately once restarted.

Thanks

1 Like

(imported comment written by NoahSalzman)

According To Ben ™

The easiest way is to add the restart Fixlet to a baseline as the middle action (you can create a custom Task to do the restart if you want to ensure a restart occurs).

http://forum.bigfix.com/viewtopic.php?id=2934

(imported comment written by cstoneba)

When I needed this, I just restared it with a vbs script. within the action.

// restart computer

delete __appendfile

appendfile Set objWMIService = GetObject(“winmgmts:” _

appendfile & “{{impersonationLevel=impersonate,(Shutdown)}!\.\root\cimv2”)

appendfile Set colOperatingSystems = objWMIService.ExecQuery _

appendfile (“Select * from Win32_OperatingSystem”)

appendfile For Each objOperatingSystem in colOperatingSystems

appendfile ObjOperatingSystem.Reboot()

appendfile Next

move __appendfile restart.vbs

waithidden “{pathname of system folder}\wscript.exe” restart.vbs

delete restart.vbs

(imported comment written by BenKus)

Hey cstoneba,

Maybe it is easier just to do something like this (rather than a vbscript that calls wmi):

restart 30

Ben

(imported comment written by cstoneba)

I think we had this discussion before (http://forum.bigfix.com/viewtopic.php?id=3052). What I didn’t like about the internal restart command is that it prompts the end user to take the action.

(imported comment written by BenKus)

Yes, but only for a moment (in this case 30 seconds) and then the restart is forced. Do you not want to prompt them at all?

Ben

(imported comment written by herrm91)

Thanks everyone for the info.

I did see those other posts in the forum. No user will be logged in some I am not worried about a prompt. I am trying to eliminate the need have to schedule 2 actions. From what I am gathering, there is no way to perform a reboot and install in the same action script.

Is this correct?

Thanks

(imported comment written by BenKus)

Hi Herrm,

Best thing to do would be to create a Task with “restart 30”, put it in a baseline with your other action, and then take the action on the systems.

Ben

(imported comment written by herrm91)

Thanks Ben.

I’ll give that shot.

(imported comment written by arpotu91)

All,

Can you tell me which OS’s work with the "restart " command? Previous posts also show use of “tsshutdn”, but that causes problems between x32 and x64 OS’s.

FYI, the restart command seemed to work fine on Windows 2003 64-bit Enterprise.

Thanks,

Arpotu.

(imported comment written by BenKus)

"restart " should work on all OSes but I haven’t manually verified myself in a long time… I think there was an issue in early 7.0 versions (maybe pre-7.0.15 if I remember correctly) where this command had weird behavior, but I think it should work fine for most versions/OSes.

Ben