Hello,
i have a list of Hostnames from computers in my network and now i want to know how i can get the computer-description from these computers.
Anybody an idea?
Kind regards Nico
Hello,
i have a list of Hostnames from computers in my network and now i want to know how i can get the computer-description from these computers.
Anybody an idea?
Kind regards Nico
You can try this:
string name =
System.Net.Dns.GetHostByName("localhost").HostName
I don't have a solution but a few pointers that might help you get going.
In general, you can access the computer description using WMI, in particular, by getting \\nameOfTheRemoteComputer\root\cimv2
, executing SELECT * FROM Win32_OperatingSystem
and querying the Description
property.
By combining these examples, you should get what you need.
All these methods use PowerShell -
You could use a one-liner.
gwmi -query "select Description from Win32_OperatingSystem" | select-object Description
Remote computer.
gwmi -computer computername -query "select Description from Win32_OperatingSystem" | select-object Description
Remote computer, passing credentials.
gwmi -computer computername -credentials domain\username -query "select Description from Win32_OperatingSystem" | select-object Description
Or from the registry
$Machine = "MachineToCheck" $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey("LocalMachine",$Machine) $regKey= $reg.OpenSubKey("System\CurrentControlSet\Services\lanmanserver\parameters") $regkey.GetValue("srvcomment")