Page 1 of 1 1
Topic Options
#179109 - 2007-08-10 03:15 PM Specify a day of week to run (new code update)
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
Im brand new to KiXtart and have never done anything like this. I have been tasked with editing our current login script which is pretty basic (if in X group map X drive).

I need to set some registry settings and run a vbs script. I think I have all the code except i want to only run this registry part and vbs part on Tuesdays...

Thanks for any suggestions.

Here what was thinking. I integrated the registry settings into my .vbs so I was wondering if this code will work

? "App Check"
;Run VB Script to do something
if WDAYNO = 3
run 'cscript \\server\netlogon\XXX.vbs'
else
Endif

I have this new vbs that I want to convert to KiX... any advice where to start ?

Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

Dim strValue
strValue = ""
'Determine most recent installed version of Java
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer\AdvancedOptions\JAVA_SUN\SELECT"
strValueName = "RegPath"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Wscript.Echo strValue 'something like Software\JavaSoft\Java Plug-in\1.6.0_02

'Set values for most recent version
If strValue <> "" Then
strKeyPath = strValue
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
End If

'Set values for java versions on the standard desktop image
'Version 1.3.1_15
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.3.1_15"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.4.2_07
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.4.2_07"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.5.0_01
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.5.0_01"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Disable Java Automatic Updates
strKeyPath = "SOFTWARE\JavaSoft\Java Update\Policy"
strValueName = "EnableJavaUpdate"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "EnableAutoUpdateCheck"
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue




Edited by John45 (2007-08-13 08:04 PM)

Top
#179111 - 2007-08-10 03:38 PM Re: Specify a day of week to run [Re: John45]
BillBarnard Offline
Starting to like KiXtart

Registered: 2007-03-14
Posts: 141
Loc: Leighton Buzzard, Bedfordshire...
The macro @day will return the day of the week.

If @day="Tuesday"

Shell "cscript YourVBS.vbs"

Endif

Then use either Shell or Run to run your vb script with cscript

Bill
_________________________
Bill

Top
#179143 - 2007-08-10 07:21 PM Re: Specify a day of week to run [Re: John45]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Why not just convert the VBS script to KiXtart and then you won't have to manage 2 different types of scripts.

99% of all VB Scripts can be easily converted. There are a few exceptions that can not but rarely do you see them in use for normal scripts.

Top
#179240 - 2007-08-13 08:01 PM Re: Specify a day of week to run [Re: NTDOC]
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
Im ashamed to admit i didnt know you could convert it.

I have no previous experience with KiX or VBS, but with all the changes around my company im getting new tasks left and right.

Ill dig around and see what else I can find.

Top
#179251 - 2007-08-13 10:52 PM Re: Specify a day of week to run [Re: John45]
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11623
Loc: CA
Well can't promise but if you post the VB Script code here (using the CODE TAGS) I'm sure someone can help convert it for you.
Top
#179275 - 2007-08-14 03:10 PM Re: Specify a day of week to run [Re: NTDOC]
John45 Offline
Fresh Scripter

Registered: 2007-08-10
Posts: 8
 Code:
Const HKEY_LOCAL_MACHINE = &H80000002

strComputer = "."

Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")

Dim strValue
strValue = ""
'Determine most recent installed version of Java
strKeyPath = "SOFTWARE\Microsoft\Internet Explorer\AdvancedOptions\JAVA_SUN\SELECT"
strValueName = "RegPath"
oReg.GetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
'Wscript.Echo strValue 'something like Software\JavaSoft\Java Plug-in\1.6.0_02

'Set values for most recent version
If strValue <> "" Then
strKeyPath = strValue
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
End If

'Set values for java versions on the standard desktop image
'Version 1.3.1_15
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.3.1_15"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.4.2_07
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.4.2_07"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Version 1.5.0_01
strKeyPath = "SOFTWARE\JavaSoft\Java Plug-in\1.5.0_01"
strValueName = "UseJava2IExplorer"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "HideSystemTrayIcon"
dwValue = 1
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue

'Disable Java Automatic Updates
strKeyPath = "SOFTWARE\JavaSoft\Java Update\Policy"
strValueName = "EnableJavaUpdate"
dwValue = 0
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue
strValueName = "EnableAutoUpdateCheck"
oReg.SetDWORDValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, dwValue


any suggestions?

Top
#179291 - 2007-08-14 09:45 PM Re: Specify a day of week to run [Re: John45]
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
ReadValue() and WriteValue() are your friends here.

Just do a read when collecting the information and write when you want to set or change it.
_________________________
Today is the tomorrow you worried about yesterday.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
1 registered (Allen) and 466 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.04 seconds in which 0.016 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org