|
View previous topic :: View next topic |
Author |
Message |
doodleman99
Joined: 02 Sep 2008 Posts: 38
|
Posted: Tue Nov 24, 2015 9:13 am Post subject: sophos vb script to get update date and time |
|
|
Hey guys,
i'm being a little stupid here - i have a really simple vbs script that translates the hex key of a registry key to a regular date format and i'd like to run a HM test based on the result/output.
if i save the file as a .vbs it runs fine but i'm being think when it comes to adding it as a shell script
the code is:
Code: |
Dim tZ, uKey, shell, lastUp
dim dateValue
tZ = 0 'time relative to GMT
uKey ="HKLM\Software\Wow6432Node\sophos\AutoUpdate\UpdateStatus\LastUpdateTime"
Set shell =CreateObject("WScript.Shell")
lastUp = shell.RegRead (uKey)
dateValue = DateAdd ("h",tZ,(DateAdd("s",lastUp,"01/01/1970 00:00:00")))
Wscript.Echo(dateValue)
|
can you help un-dumb me please? |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Tue Nov 24, 2015 9:37 am Post subject: |
|
|
Any "Shell Script" script should return reply in the following format:
ScriptRes:<Status>:<Reply>
E.g.:
ScriptRes:Ok:10
ScriptRes:Bad:3
Your script should look like the following:
Quote: | const statusUnknown = "scriptRes:Unknown:"
const statusOk = "scriptRes:Ok:"
const statusBad = "scriptRes:Bad:"
Dim tZ, uKey, shell, lastUp
dim dateValue
tZ = 0 'time relative to GMT
uKey ="HKLM\Software\Wow6432Node\sophos\AutoUpdate\UpdateStatus\LastUpdateTime"
Set shell =CreateObject("WScript.Shell")
lastUp = shell.RegRead (uKey)
dateValue = DateAdd ("h",tZ,(DateAdd("s",lastUp,"01/01/1970 00:00:00")))
WScript.StdOut.Write statusOk & dateValue |
|
|
Back to top |
|
|
doodleman99
Joined: 02 Sep 2008 Posts: 38
|
Posted: Tue Nov 24, 2015 10:05 am Post subject: |
|
|
i knew i was being stupid
thanks for your super fast response (as always) |
|
Back to top |
|
|
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Tue Nov 24, 2015 10:38 am Post subject: |
|
|
You are welcome. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|