KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

sophos vb script to get update date and time

 
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting
View previous topic :: View next topic  
Author Message
doodleman99



Joined: 02 Sep 2008
Posts: 38

PostPosted: Tue Nov 24, 2015 9:13 am    Post subject: sophos vb script to get update date and time Reply with quote

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
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue Nov 24, 2015 9:37 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
doodleman99



Joined: 02 Sep 2008
Posts: 38

PostPosted: Tue Nov 24, 2015 10:05 am    Post subject: Reply with quote

i knew i was being stupid
thanks for your super fast response (as always)
Back to top
View user's profile Send private message
KS-Soft Europe



Joined: 16 May 2006
Posts: 2832

PostPosted: Tue Nov 24, 2015 10:38 am    Post subject: Reply with quote

You are welcome.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> Configuration, Maintenance, Troubleshooting All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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

KS-Soft Forum Index