Visual Basic Script

pa

Как получить информацию об операционной системе при помощи WMI - часть 3


Dim dtb As String Dim d As String Dim t As String Dim bias As Long

On Local Error Resume Next

Set wmiObjSet = GetObject("winmgmts:{impersonationLevel=impersonate}")._ InstancesOf("Win32_OperatingSystem")

For Each obj In wmiObjSet

'информация о версии

Set itmx = ListView1.ListItems.Add(, , "Operating System") itmx.SubItems(1) = obj.Caption Set itmx = ListView1.ListItems.Add(, , "Version") itmx.SubItems(1) = obj.Version Set itmx = ListView1.ListItems.Add(, , "BuildNumber") itmx.SubItems(1) = obj.BuildNumber Set itmx = ListView1.ListItems.Add(, , "BuildType") itmx.SubItems(1) = obj.BuildType Set itmx = ListView1.ListItems.Add(, , "Latest Service Pack") itmx.SubItems(1) = obj.CSDVersion Set itmx = ListView1.ListItems.Add(, , "EncryptionLevel") itmx.SubItems(1) = obj.EncryptionLevel & "-bit" Set itmx = ListView1.ListItems.Add(, , "OSType") Select Case obj.OSType Case 15: msg = "WIN3x" Case 16: msg = "WIN95" Case 17: msg = "WIN98" Case 18: msg = "WINNT" Case 19: msg = "WINCE" Case Else: msg = "non-windows - see MSDN for complete list" End Select itmx.SubItems(1) = msg

'информация о системе

Set itmx = ListView1.ListItems.Add(, , "BootDevice") itmx.SubItems(1) = obj.BootDevice Set itmx = ListView1.ListItems.Add(, , "RegisteredUser") itmx.SubItems(1) = obj.RegisteredUser Set itmx = ListView1.ListItems.Add(, , "SerialNumber") itmx.SubItems(1) = obj.SerialNumber Set itmx = ListView1.ListItems.Add(, , "Status") itmx.SubItems(1) = obj.Status Set itmx = ListView1.ListItems.Add(, , "SystemDevice") itmx.SubItems(1) = obj.SystemDevice Set itmx = ListView1.ListItems.Add(, , "SystemDrive") itmx.SubItems(1) = obj.SystemDrive Set itmx = ListView1.ListItems.Add(, , "WindowsDirectory") itmx.SubItems(1) = obj.WindowsDirectory Set itmx = ListView1.ListItems.Add(, , "SystemDirectory") itmx.SubItems(1) = obj.SystemDirectory




Начало  Назад  Вперед



Книжный магазин