C# 如何根据计算机主机名获取网络中计算机的序列号?

C# 如何根据计算机主机名获取网络中计算机的序列号?,c#,javascript,vbscript,network-programming,C#,Javascript,Vbscript,Network Programming,由此,我可以获取我的机器的序列号,但如何获取网络中其他计算机的序列号请确保: (Windows)远程计算机上的防火墙/DCOM设置不会阻止您的请求 您具有远程计算机的凭据 更多信息和代码示例可在MSDN网站上找到: ComputerName = InputBox("Enter the name of the computer you wish to query") winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"&

由此,我可以获取我的机器的序列号,但如何获取网络中其他计算机的序列号请确保:

  • (Windows)远程计算机上的防火墙/DCOM设置不会阻止您的请求
  • 您具有远程计算机的凭据
更多信息和代码示例可在MSDN网站上找到:

ComputerName = InputBox("Enter the name of the computer you wish to query")

winmgmt1 = "winmgmts:{impersonationLevel=impersonate}!//"& ComputerName &""

'WScript.Echo winmgmt1

Set SNSet = GetObject( winmgmt1 ).InstancesOf ("Win32_BIOS")

for each SN in SNSet
MsgBox "The serial number for the specified computer is: " & SN.SerialNumber
Next