Location: List Archives

List Archives

This forum is an archive of all posts to our mailing list over the past few years.  The forum is set read only therefore to contribute you will need to join our list community.  See more info about this here.

 

When subscribed to the list you should use your standard email client to send your posts to ActiveDir@mail.activedir.org.

List Archives

Subject: [ActiveDir] Kix to .vbs
Prev Next
You are not authorized to post a reply.

AuthorMessages
dhardingUser is Offline

Posts:26

11/14/2005 4:53 AM  
What would be the simplest way to convert this kix scrip to
..vbs?





; **** If
workstation, exit script

If @ProductType =
"Windows 2000 Professional" or @ProductType = "Windows XP
Professional" or @ProductType = "Windows NT Workstation"

            cls

            Exit

Endif



; **** Check / Set
VNC application hooks for logon.scr screen saver

$ReturnCode =
KeyExist("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr")

If $ReturnCode=0

            Addkey("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_Deferral",1,"reg_dword")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_use_GetUpdateRect",1,"reg_dword")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_KeyPress",1,"reg_dword")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_LButtonUp",1,"reg_dword")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_MButtonUp",1,"reg_dword")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_RButtonUp",1,"reg_dword")

            WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_Timer",0,"reg_dword")

EndIf





; **** Check / Set
registry settings for BGINFO

$ReturnCode =
KeyExist("HKCU\Software\Winternals")

If $ReturnCode = 0
            Addkey("HKCU\Software\Winternals")

EndIf



$ReturnCode =
KeyExist("HKCU\Software\Winternals\BGInfo")

If $ReturnCode = 0

            Addkey("HKCU\Software\Winternals\BGInfo")

            WriteValue("HKCU\Software\Winternals\BGInfo","Background",0,"reg_dword")

            WriteValue("HKCU\Software\Winternals\BGInfo","Foreground",16777215,"reg_dword")

EndIf



; **** Run BGINFO
from NetLogon share

Run @Ldrive +
"\bginfo.exe /i\\gsfps\netlogon\newbginfo.bgi /timer:0"





; **** Check / Set
registry settings for screen saver.  Logoff user if settings are updated

$IsLocked =
ReadValue("HKCU\Control
Panel\Desktop","ScreenSaverIsSecure")

$SSTimeOut =
ReadValue("HKCU\Control Panel\Desktop","ScreenSaveTimeout")

$SSActive =
ReadValue("HKCU\Control Panel\Desktop","ScreenSaveActive")

$ScrnSave =
ReadValue("HKCU\Control Panel\Desktop","SCRNSAVE.EXE")

If $IsLocked = 0
or (VAL($SSTimeOut) > 900) or $SSActive = 0 or $ScrnSave = ""

            WriteValue("HKCU\Control
Panel\Desktop","ScreenSaverIsSecure","1","reg_sz")

            WriteValue("HKCU\Control
Panel\Desktop","ScreenSaveActive","1","reg_sz")

            WriteValue("HKCU\Control
Panel\Desktop","ScreenSaveTimeout","900","reg_sz")

            WriteValue("HKCU\Control
Panel\Desktop","SCRNSAVE.EXE","%system
root%\system32\logon.scr","reg_sz")

            MessageBox("ScreenSaver
settings were not previously set.  Settings have been updated.  A logout is
required to activate new settings.  Click Ok and the system will logout you out
now.  Auto-logoff in 20 seconds.","Logout Required",4112,20)

            Logoff(1)

EndIf



Devon Harding

Windows Systems Engineer

Southern Wine & Spirits
- BSG

954-602-2469




__________________________________This message and any attachments are solely for the intended recipientand may contain confidential or privileged information. If you are notthe intended recipient, any disclosure, copying, use or distribution ofthe information included in the message and any attachments isprohibited. If you have received this communication in error, pleasenotify us by reply e-mail and immediately and permanently delete thismessage and any attachments. Thank You.
alainlissoirUser is Offline

Posts:3

11/14/2005 5:02 AM  
Have a look
at http://www.lissware.net, vol 1, Sample
1.01 to 1.25 - WSHScript.vbs.
This script
contains all subroutines you need to read, write registry, env. variables, etc
... from .vbs.

With this
cscript, you will easily convert you kix script below into a
.vbs.
You just need
to tweak the fucntion calls and return codes accordingly and reuse the set of
registry keys your kix script references.

HTH.

Private Function GetRunTimeEnvInfo
(classRunTimeEnvironmentInfo)
Private Function LogRunTimeEnvInfo (objFileName,
classRunTimeEnvironmentInfo)
Private Function ReadRegistry (objFileName, strKeyName,
KeyValueName, strRegType)
Private Function WriteRegistry (objFileName, strKeyName, KeyValueName,
strRegType, varRegKeyValue)
Private Function DeleteRegistry (objFileName, strKeyName,
KeyValueName)
Private Function EnumerateDriveConnections
(objFileName)
Private Function ConnectNetworkDrive (objFileName, strDriveLetter,
strShareName)
Private Function DisconnectNetworkDrive (objFileName, strDriveLetter,
boolConfirm)
Private Function EnumeratePrinterConnections
(objFileName)
Private Function ConnectWindowsNetworkPrinter (objFileName, strShareName,
boolDefault)
Private Function ConnectNetworkPrinter (objFileName, strLPT,
strShareName)
Private Function DisconnectNetworkPrinter (objFileName, strLPT,
boolConfirm)
Private Function ReadEnvironmentVariable (objFileName,
strEnvironmentType, strVarName)
Private Function CreateEnvironmentVariable (objFileName,
strEnvironmentType, strVarName, varValue)
Private Function RemoveEnvironmentVariable (objFileName,
strEnvironmentType, strVarName)
Private Function GetAllEnvironmentVariables (objFileName,
strEnvironmentType)
Private Function ReadCommandLineArgument (objFileName,
strParameterList)
Private Function ErrorHandler (objFileName, strFunctionName, Err,
boolPopupErrors)
Private Function CreateTextFile (strFileName)
Private Function CloseTextFile (objFileName)
Private Function WriteToFile (objFileName, strText)

/Alain
From: ActiveDir-owner@xxxxxxxxxxxxxxxxxx
[mailto:ActiveDir-owner@xxxxxxxxxxxxxxxxxx] On Behalf Of Harding,
DevonSent: Monday, November 14, 2005 8:49 AMTo:
ActiveDir@xxxxxxxxxxxxxxxxxxSubject: [ActiveDir] Kix to
.vbs

What would be the simplest way to
convert this kix scrip to ..vbs?


; **** If
workstation, exit script
If @ProductType
= "Windows 2000 Professional" or @ProductType = "Windows XP Professional" or
@ProductType = "Windows NT Workstation"

cls

Exit
Endif

; **** Check /
Set VNC application hooks for logon.scr screen
saver
$ReturnCode =
KeyExist("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr")
If
$ReturnCode=0

Addkey("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_Deferral",1,"reg_dword")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_use_GetUpdateRect",1,"reg_dword")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_KeyPress",1,"reg_dword")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_LButtonUp",1,"reg_dword")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_MButtonUp",1,"reg_dword")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_RButtonUp",1,"reg_dword")

WriteValue("HKCU\Software\ORL\VNCHooks\Application_Prefs\logon.scr","use_Timer",0,"reg_dword")
EndIf


; **** Check /
Set registry settings for BGINFO
$ReturnCode =
KeyExist("HKCU\Software\Winternals")
If $ReturnCode =
0

Addkey("HKCU\Software\Winternals")
EndIf

$ReturnCode =
KeyExist("HKCU\Software\Winternals\BGInfo")
If $ReturnCode =
0

Addkey("HKCU\Software\Winternals\BGInfo")

WriteValue("HKCU\Software\Winternals\BGInfo","Background",0,"reg_dword")

WriteValue("HKCU\Software\Winternals\BGInfo","Foreground",16777215,"reg_dword")
EndIf

; **** Run
BGINFO from NetLogon share
Run @Ldrive +
"\bginfo.exe /i\\gsfps\netlogon\newbginfo.bgi
/timer:0"



; **** Check /
Set registry settings for screen saver.  Logoff user if settings are
updated
$IsLocked =
ReadValue("HKCU\Control
Panel\Desktop","ScreenSaverIsSecure")
$SSTimeOut =
ReadValue("HKCU\Control
Panel\Desktop","ScreenSaveTimeout")
$SSActive =
ReadValue("HKCU\Control
Panel\Desktop","ScreenSaveActive")
$ScrnSave =
ReadValue("HKCU\Control
Panel\Desktop","SCRNSAVE.EXE")
If $IsLocked = 0
or (VAL($SSTimeOut) > 900) or $SSActive = 0 or $ScrnSave =
""

WriteValue("HKCU\Control
Panel\Desktop","ScreenSaverIsSecure","1","reg_sz")

WriteValue("HKCU\Control
Panel\Desktop","ScreenSaveActive","1","reg_sz")

WriteValue("HKCU\Control
Panel\Desktop","ScreenSaveTimeout","900","reg_sz")

WriteValue("HKCU\Control Panel\Desktop","SCRNSAVE.EXE","%system
root%\system32\logon.scr","reg_sz")

MessageBox("ScreenSaver settings were not previously set.  Settings have
been updated.  A logout is required to activate new settings.  Click
Ok and the system will logout you out now.  Auto-logoff in 20
seconds.","Logout Required",4112,20)

Logoff(1)
EndIf

Devon
Harding
Windows Systems
Engineer
Southern Wine & Spirits
- BSG
954-602-2469



__________________________________This message and any
attachments are solely for the intended recipientand may contain
confidential or privileged information. If you are notthe intended
recipient, any disclosure, copying, use or distribution ofthe information
included in the message and any attachments isprohibited. If you have
received this communication in error, pleasenotify us by reply e-mail and
immediately and permanently delete thismessage and any attachments. Thank
You.
You are not authorized to post a reply.



ActiveForums 3.7
AdventNet Banner
Friends

Friends

Namescape
Members

Members

MembershipMembership:
Latest New UserLatest:kosciesza69
New TodayNew Today:3
New YesterdayNew Yesterday:1
User CountOverall:4319

People OnlinePeople Online:
VisitorsVisitors:131
MembersMembers:0
TotalTotal:131

Online NowOnline Now:

Ads

Copyright 2008 ActiveDir.org
Terms Of Use