Link to home
Start Free TrialLog in
Avatar of LouisvilleMetro
LouisvilleMetro

asked on

reg add script to change SNMP sysLocation.

I have a script to add snmp settings a group of servers that need to be monitored by HP SIM. The script work fine except I have been asked to add a different "Value Data" to the "sysLocation". The sysLocation string value is a default windows value wiht no entry for "value data". I need to change that using my reg add script.

I have tried to add the value, delete the value and recreate. It seems the  string is locked, the permissions are correct. I am just having issues with this one string.

Has anyone scripted the attribute change to this string? If so how? thanks ahead of time for the help.
objshell.Run "reg add \\" & strComputer & "\HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent\ /ve sysLocation /t REG_SZ /d XX-location-XX"

Open in new window

Avatar of Don
Don
Flag of United States of America image

Try below:
 
DIM Path,Location
Path="HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent\"
Location="XX-location-XX"
WshShell.RegWrite  Path & "sysLocation",Location,"REG_SZ"
More complete below:
 

DIM Path,Location,WshShell
Set WshShell = CreateObject("WScript.Shell")
Path="HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent\"
Location="XX-location-XX"
WshShell.RegWrite  Path & "sysLocation",Location,"REG_SZ"
Avatar of LouisvilleMetro
LouisvilleMetro

ASKER

It changes the attribute! I am curious as to why the reg add will not change the value. Do you have any insight into this?

thanks again for your help.
ASKER CERTIFIED SOLUTION
Avatar of Don
Don
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks again!