最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
WMI学习
时间:2022-07-02 23:28:31 编辑:袖梨 来源:一聚教程网
WMI:Windows Management Instrument
WMI Tasks:
1、Accounts and Domains
①determine the domain in which a computer belongs:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" _
& strComputer & "ootcimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
msgbox "System Name: " & objComputer.Name
msgbox "Domain: " & objComputer.Domain
Next
②determine whether a computer is a server or a workstation:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" _
& strComputer & "ootcimv2")
Set colComputers = objWMIService.ExecQuery _
("Select DomainRole from Win32_ComputerSystem")
For Each objComputer in colComputers
Select Case objComputer.DomainRole
Case 0
strComputerRole = "Standalone Workstation"
Case 1 strComputerRole = "Member Workstation"
Case 2
strComputerRole = "Standalone Server"
Case 3
strComputerRole = "Member Server"
Case 4
strComputerRole = "Backup Domain Controller"
Case 5
strComputerRole = "Primary Domain Controller"
End Select
msgbox strComputerRole
Next
③determine the computer name:
WMI Tasks:
1、Accounts and Domains
①determine the domain in which a computer belongs:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" _
& strComputer & "ootcimv2")
Set colSettings = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colSettings
msgbox "System Name: " & objComputer.Name
msgbox "Domain: " & objComputer.Domain
Next
②determine whether a computer is a server or a workstation:
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!" _
& strComputer & "ootcimv2")
Set colComputers = objWMIService.ExecQuery _
("Select DomainRole from Win32_ComputerSystem")
For Each objComputer in colComputers
Select Case objComputer.DomainRole
Case 0
strComputerRole = "Standalone Workstation"
Case 1 strComputerRole = "Member Workstation"
Case 2
strComputerRole = "Standalone Server"
Case 3
strComputerRole = "Member Server"
Case 4
strComputerRole = "Backup Domain Controller"
Case 5
strComputerRole = "Primary Domain Controller"
End Select
msgbox strComputerRole
Next
③determine the computer name:
相关文章
- 《潜行者2:切尔诺贝利之心》盗亦无道任务的房子进入方法介绍 11-25
- 《潜行者2:切尔诺贝利之心》高斯枪获得方法介绍 11-25
- 《潜行者2:切尔诺贝利之心》圣碑兵出现位置介绍 11-25
- 《真三国无双:起源》貂蝉介绍 11-25
- 《潜行者2:切尔诺贝利之心》刷高斯枪方法介绍 11-25
- 《潜行者2:切尔诺贝利之心》高斯枪使用攻略 11-25