I'm trying to determine and echo the locational DHCP server for users who travel throughout my company. This is what I have come up with so far, but it doesn't work properly. Since the DHCPServer property of Win32_NetworkAdapter Configuration is a string, I figured this would be easy, but has turned out far more difficult than I thought. Thanks in advance!
Code:
strpc = "."
Set behrwmiservice = GetObject("winmgmts:\\"& strpc & "\root\cimv2")
Set locationdhcpserv = behrwmiservice.ExecQuery _
("Select DHCPServer from Win32_NetworkAdapterConfiguration")
wscript.echo locationdhcpserv.DHCPServer
Code:
strpc = "."
Set behrwmiservice = GetObject("winmgmts:\\"& strpc & "\root\cimv2")
Set locationdhcpserv = behrwmiservice.ExecQuery _
("Select DHCPServer from Win32_NetworkAdapterConfiguration")
wscript.echo locationdhcpserv.DHCPServer