get computer description from computer in network
i have a lis开发者_开发问答t 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?
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.
- Here is an example in "old" VB accessing this data: http://www.vbforums.com/showthread.php?t=344879, and
- here is an example of accessing WMI with VB.NET: http://nishantpant.files.wordpress.com/2006/11/wmivb.txt.
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")
精彩评论