Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 675
  • Last Modified:

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

0
LouisvilleMetro
Asked:
LouisvilleMetro
  • 3
  • 2
1 Solution
 
Donald StewartNetwork AdministratorCommented:
Try below:
 
DIM Path,Location
Path="HKLM\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent\"
Location="XX-location-XX"
WshShell.RegWrite  Path & "sysLocation",Location,"REG_SZ"
0
 
Donald StewartNetwork AdministratorCommented:
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"
0
 
LouisvilleMetroAuthor Commented:
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.
0
 
Donald StewartNetwork AdministratorCommented:
not sure, have always used the regwrite method
0
 
LouisvilleMetroAuthor Commented:
Thanks again!
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now