Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trying to Run a VBscript from AD Group Policy Startup Folder

Status
Not open for further replies.

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
 
psbrown,

At startup time, HKEY_CURRENT_USER has no meaning. That is the problem, I think.

regards - tsuji
 
Further notes:

Okay, I see you're writing HKEY_LOCAL_MACHINE, so that is not the problem I've thought. It could then be the permission issue. Startup script is running under system account credential---to check, which has not all the rights of the admin.

- tsuji
 
Thanks Tsjui
Seems that is the case I put the script in the ou logon scripts and it worked.

Can anyone reccomend a way of modifying the script so it can be ran at startup?

Thanks

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top