获取主机名的vbs(cmdlib.wsc)
脚本专栏 发布日期:2024/12/28 浏览次数:1
正在浏览:获取主机名的vbs(cmdlib.wsc)
复制代码 代码如下:
strComputer = "."
Set objCmdLib = CreateObject("Microsoft.CmdLib")
Set objCmdLib.ScriptingHost = WScript.Application
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
WScript.Echo objCmdLib.getHostName(objWMIService)