Dim oContainer
Set oContainer=GetObject("LDAP://DC=<YOUR DOMAIN HERE>,DC=com")
ListComputers oContainer
Set oContainer = Nothing
Sub ListComputers(oObject)
Dim Object
For Each Object in oObject
If Object.Class = "organizationalUnit" Then
ListComputers ( Object )
End If
If Object.Class = "computer" Then
Name = Object.Name
Name = Mid( Name, 4 )
WScript.Echo "Computer Name: "
WScript.Echo Name
On Error Resume Next
WScript.Echo "Logged in User(s): "
WScript.Echo GetUser( Name )
WScript.Echo "Installed Applications: "
WScript.Echo InstalledApplications( Name )
WScript.Echo ""
WScript.Echo ""
End If
Next
End Sub
Function GetUser( strComputer )
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colComputer = objWMIService.ExecQuery _
("Select * from Win32_ComputerSystem")
For Each objComputer in colComputer
GetUser = GetUser & objComputer.UserName & vblf
Next
End Function
Function InstalledApplications(node)
Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
Set oRegistry = _
GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
& node & "/root/default:StdRegProv")
sBaseKey = _
"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
For Each sKey In arSubKeys
iRC = oRegistry.GetStringValue( _
HKLM, sBaseKey & sKey, "DisplayName", sValue)
If iRC <> 0 Then
oRegistry.GetStringValue _
HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
End If
If sValue <> "" Then
InstalledApplications = _
InstalledApplications & sValue & vbCrLf
End If
Next
End Function
--
С уважением, Ратнер Арсений
a.ratner@autoemex.ru
Комментариев нет:
Отправить комментарий