This powershell script will get the HyperV Host server FQDN and save as a variable to input as the Location in the Location field of SNMP. Updates to the SNMP agent will require the agent to be restarted to take effect.
$VMHost
= (get-item
“HKLM:\SOFTWARE\Microsoft\Virtual Machine\Guest\Parameters”).GetValue(“HostName”)
$SNMPAgent
=
“HKLM:\SYSTEM\CurrentControlSet\services\SNMP\Parameters\RFC1156Agent”
Set-ItemProperty
-path
$SNMPAgent
-Name
sysLocation
-value
$VMHost.ToString()
Leave a Reply