(imported topic written by RichB91)
To deal with ongoing struggles of some Windows 2003 SP2 servers not always rebooting when issued either a
Restart 30
from BigFix or even with a
shutdown /r /f /m \servername /t 30
from a command line, I’ve been tasked with verifying that a reboot occurred within the expected window before proceeding.
Here’s a highly simplified sample of the code with which I’ve been experimenting:
Baseline
Task #1
Parameter “DirLogs” = "C:"
Parameter “RebootTimeStamp” = “RebootTimeStamp.txt”
Delete __Appendfile
Appendfile {Now}
Copy __Appendfile {Parameter “DirLogs” & Parameter “RebootTimeStamp”}
Restart 5
Task #2
Parameter “DirLogs” = "C:"
Parameter “RebootTimeStamp” = “RebootTimeStamp.txt”
Parameter “RebootTime” = “{Line of File (Parameter “DirLogs” & Parameter “RebootTimeStamp”)}”
color=blueIf ((Now - Uptime of Operating System) > (Line of File (Parameter “DirLogs” & Parameter “RebootTimeStamp”)) as Time) Then[/color]
Code to proceed…
Else
Code to notify unexpected result…
EndIf
But, regardless of whether I use
or
< in the
If statement, it always evaluates to the Else statement.
It appears to work in QnA but not in the Action test tab or in a live test from the BigFix console.
I suspect I’m just messing up the {} and () symbols in the If statement. Can someone tell me what will work?
Here are the QnA results:
q: Now
A: Mon, 20 Dec 2010 10:09:21 -0500
T: 0.087 ms
q: Uptime of Operating System
A: 2 days, 17:50:19
T: 180.916 ms
Q: Now - Uptime of Operating System
A: Fri, 17 Dec 2010 16:19:03 -0500
T: 179.899 ms
Q: (Line of File “C:\RebootTimeStamp.txt”) as time
A: Fri, 17 Dec 2010 16:48:14 -0500
T: 1.771 ms
Q: ((Now - Uptime of Operating System) > (Line of File “C:\RebootTimeStamp.txt”) as Time)
A: False
T: 182.315 ms
Q: ((Now - Uptime of Operating System) < (Line of File “C:\RebootTimeStamp.txt”) as Time)
A: True
T: 184.806 ms
- Rich B