psbrown
MIS
- Oct 16, 2001
- 40
I am new to scripring and am trying to get the script listed below to work as a GPO startup script.
It works when I double click it but does not run at startup.
I am trying to determin if the problem is with AD or the script.
Could you please advise if there somthing missing from the script to make it run before someone is logged on.
Thanks
Paul
'On Error Resume Next 'do not uncomment for no reason
'********set up varaibles for computer*******
HKEY_CURRENT_USER = &H80000001
HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
'************disable USBStor by setting to 4 hexadeciaml*************'
'***set variable strkeypath***
strKeyPath = "system\CurrentControlSet\Services\USBSTOR"
'***set variable valuename***
ValueName = "Start"
'***set variable strvalue***
dwValue = 4
iret=objReg.createkey(HKEY_LOCAL_MACHINE, strKeyPath)
'wscript.echo iret 'should be 0 for success
'***update registry with settings***
iret=objReg.SetDwordValue(HKEY_LOCAL_MACHINE, strKeyPath, ValueName, dwValue)
set objReg=nothing
It works when I double click it but does not run at startup.
I am trying to determin if the problem is with AD or the script.
Could you please advise if there somthing missing from the script to make it run before someone is logged on.
Thanks
Paul
'On Error Resume Next 'do not uncomment for no reason
'********set up varaibles for computer*******
HKEY_CURRENT_USER = &H80000001
HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
'************disable USBStor by setting to 4 hexadeciaml*************'
'***set variable strkeypath***
strKeyPath = "system\CurrentControlSet\Services\USBSTOR"
'***set variable valuename***
ValueName = "Start"
'***set variable strvalue***
dwValue = 4
iret=objReg.createkey(HKEY_LOCAL_MACHINE, strKeyPath)
'wscript.echo iret 'should be 0 for success
'***update registry with settings***
iret=objReg.SetDwordValue(HKEY_LOCAL_MACHINE, strKeyPath, ValueName, dwValue)
set objReg=nothing