如何在WMI脚本下写入WMIC?
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\Microsoft\SqlServer\ComputerManagement10")
Set colItems = objWMIService.ExecQuery( _
"SELECT * FROM ServerNetworkProtocol",,48)
For Each objItem in colItems
Wscript.Echo "-----------------------------------"
Wscript.Echo "ServerNetworkProtocol instance"
Wscript.Echo "-----------------------------------"
Wscript.Echo "Enabled: " & objItem.Enabled
Wscript.Echo "ProtocolName: " & objItem.ProtocolName
Next
答案 0 :(得分:1)
WMIC Command:
wmic / namespace:\\ root \ Microsoft \ SqlServer \ ComputerManagement10 path ServerNetworkProtocol get / all
Enabled InstanceName MultiIpConfigurationSupport ProtocolDisplayName ProtocolName
TRUE MSSQLEXPRESS FALSE Shared Memory Sm
FALSE MSSQLEXPRESS FALSE Named Pipes Np
FALSE MSSQLEXPRESS TRUE TCP/IP Tcp
FALSE MSSQLEXPRESS FALSE VIA Via
PowerShell命令:
powershell -command“Get-WmiObject -Namespace root \ Microsoft \ SqlServer \ ComputerManagement10-Class ServerNetworkProtocol | Format-Table Enabled,MultiIpConfigurationSupport,ProtocolDisplayName,ProtocolName -AutoSize”
Enabled MultiIpConfigurationSupport ProtocolDisplayName ProtocolName
------- --------------------------- ------------------- ------------
True False Shared Memory Sm
False False Named Pipes Np
False True TCP/IP Tcp
False False VIA Via