获取主机名的vbs(cmdlib.wsc)
发布时间:2016-12-28 来源:查字典编辑
摘要:复制代码代码如下:strComputer="."SetobjCmdLib=CreateObject("Microsoft.CmdLib")S...
复制代码 代码如下:
strComputer = "."
Set objCmdLib = CreateObject("Microsoft.CmdLib")
Set objCmdLib.ScriptingHost = WScript.Application
Set objWMIService = GetObject("winmgmts:" & strComputer & "rootcimv2")
WScript.Echo objCmdLib.getHostName(objWMIService)