psbrown
MIS
- Oct 16, 2001
- 40
Hi.
We are trying to disable usb memory sticks on our pc's dependant on the user.
One way to do it is via Active directory and another is to change the value of
hkey_local_machine\system\currentcontrolset\services\usbstor\start from 3 (enabled) to 4 (Disabled)
I am still a learner in the scripting game and have tried to modify a script I have used in the past to achive this as listed below.
Any advice on why this does not work would be greatly appreciated.
Thanks
Paul
On Error Resume Next
'********set up varaibles for computer*******
HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
'************disable USBStor by setting to 4 hexadeciaml*************'
objReg.createkey HKEY_LOCAL_MACHINE, strKeyPath, ValueName
'***set variable strkeypath***
strKeyPath = "system\CurrentControlSet\Services\USBSTOR"
'***set variable valuename***
ValueName = "Start"
'***set variable strvalue***
strValue = hex(4)
'***update registry with settings***
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, ValueName, strValue
We are trying to disable usb memory sticks on our pc's dependant on the user.
One way to do it is via Active directory and another is to change the value of
hkey_local_machine\system\currentcontrolset\services\usbstor\start from 3 (enabled) to 4 (Disabled)
I am still a learner in the scripting game and have tried to modify a script I have used in the past to achive this as listed below.
Any advice on why this does not work would be greatly appreciated.
Thanks
Paul
On Error Resume Next
'********set up varaibles for computer*******
HKEY_CURRENT_USER = &H80000001
strComputer = "."
Set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
'************disable USBStor by setting to 4 hexadeciaml*************'
objReg.createkey HKEY_LOCAL_MACHINE, strKeyPath, ValueName
'***set variable strkeypath***
strKeyPath = "system\CurrentControlSet\Services\USBSTOR"
'***set variable valuename***
ValueName = "Start"
'***set variable strvalue***
strValue = hex(4)
'***update registry with settings***
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, ValueName, strValue