vba ad域服务器信息怎么获取,获取AD域用户登入信息
'获取ad4域下的当前用户信息
Private Sub Test()
Dim strComputer As String
Dim objWMI As Object
Dim colIP As Object
Dim IP As Object
Dim i As Integer
strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colIP = objWMI.ExecQuery _
("Select * from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")
For Each IP In colIP
If Not IsNull(IP.IPAddress) Then
For i = LBound(IP.IPAddress) To UBound(IP.IPAddress)
MsgBox IP.IPAddress(i), vbInformation, IP.Description(i)
Next
End If
Next
MsgBox "Excel版本信息为:" & Application.CalculationVersion
'MsgBox "Excel当前允许使用的内存为:" & Application.MemoryFree
'MsgBox "Excel当前已使用的内存为:" & Application.MemoryUsed
'MsgBox "Excel可以使用的内存为:" & Application.MemoryTotal
'MsgBox "本机操作系统的名称和版本为:" & Application.OperatingSystem
MsgBox "本产品所登记的组织名为:" & Application.OrganizationName
MsgBox "当前用户名为:" & Application.UserName
MsgBox "当前使用的Excel版本为:" & Application.Version
End Sub