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()

 

 

Posted in

Leave a Reply

Discover more from Who's the Man Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading