Windows Version von Remote-PC

  • Hallo mal wieder!

    Wie könnte ich folgendes Problem realisieren:

    Ich will die Windows Version eines Remote-PCs auslesen und ausgeben lassen!

    Vielleicht WMI? hab gar kein plan wie ich das anstellen soll!

    Greetz Oli

    • Offizieller Beitrag

    Hallo!

    Hiermit sollte es gehen, einfach in $strComputer den gewünschten Rechnernamen oder IP-Adresse eintragen:

    Spoiler anzeigen
    [autoit]

    ; Erstellt von AutoIt Scriptomatic
    $wbemFlagReturnImmediately=0x10
    $wbemFlagForwardOnly=0x20
    $colItems=""
    $strComputer="localhost"
    $Output=""
    $Output&="Computer: " &$strComputer & @CRLF
    $Output&="==========================================" & @CRLF
    $objWMIService=ObjGet("winmgmts:\\" &$strComputer &"\root\CIMV2")
    $colItems=$objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
    $wbemFlagReturnImmediately + $wbemFlagForwardOnly)
    If IsObj($colItems) Then
    For $objItem In $colItems
    $Output&="BootDevice: " &$objItem.BootDevice & @CRLF
    $Output&="BuildNumber: " &$objItem.BuildNumber & @CRLF
    $Output&="BuildType: " &$objItem.BuildType & @CRLF
    $Output&="Caption: " &$objItem.Caption & @CRLF
    $Output&="CodeSet: " &$objItem.CodeSet & @CRLF
    $Output&="CountryCode: " &$objItem.CountryCode & @CRLF
    $Output&="CreationClassName: " &$objItem.CreationClassName & @CRLF
    $Output&="CSCreationClassName: " &$objItem.CSCreationClassName & @CRLF
    $Output&="CSDVersion: " &$objItem.CSDVersion & @CRLF
    $Output&="CSName: " &$objItem.CSName & @CRLF
    $Output&="CurrentTimeZone: " &$objItem.CurrentTimeZone & @CRLF
    $Output&="Debug: " &$objItem.Debug & @CRLF
    $Output&="Description: " &$objItem.Description & @CRLF
    $Output&="Distributed: " &$objItem.Distributed & @CRLF
    $Output&="ForegroundApplicationBoost: " &$objItem.ForegroundApplicationBoost & @CRLF
    $Output&="FreePhysicalMemory: " &$objItem.FreePhysicalMemory & @CRLF
    $Output&="FreeSpaceInPagingFiles: " &$objItem.FreeSpaceInPagingFiles & @CRLF
    $Output&="FreeVirtualMemory: " &$objItem.FreeVirtualMemory & @CRLF
    $Output&="InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
    $Output&="LastBootUpTime: " & WMIDateStringToDate($objItem.LastBootUpTime) & @CRLF
    $Output&="LocalDateTime: " & WMIDateStringToDate($objItem.LocalDateTime) & @CRLF
    $Output&="Locale: " &$objItem.Locale & @CRLF
    $Output&="Manufacturer: " &$objItem.Manufacturer & @CRLF
    $Output&="MaxNumberOfProcesses: " &$objItem.MaxNumberOfProcesses & @CRLF
    $Output&="MaxProcessMemorySize: " &$objItem.MaxProcessMemorySize & @CRLF
    $Output&="Name: " &$objItem.Name & @CRLF
    $Output&="NumberOfLicensedUsers: " &$objItem.NumberOfLicensedUsers & @CRLF
    $Output&="NumberOfProcesses: " &$objItem.NumberOfProcesses & @CRLF
    $Output&="NumberOfUsers: " &$objItem.NumberOfUsers & @CRLF
    $Output&="Organization: " &$objItem.Organization & @CRLF
    $Output&="OSLanguage: " &$objItem.OSLanguage & @CRLF
    $Output&="OSProductSuite: " &$objItem.OSProductSuite & @CRLF
    $Output&="OSType: " &$objItem.OSType & @CRLF
    $Output&="OtherTypeDescription: " &$objItem.OtherTypeDescription & @CRLF
    $Output&="PlusProductID: " &$objItem.PlusProductID & @CRLF
    $Output&="PlusVersionNumber: " &$objItem.PlusVersionNumber & @CRLF
    $Output&="Primary: " &$objItem.Primary & @CRLF
    $Output&="QuantumLength: " &$objItem.QuantumLength & @CRLF
    $Output&="QuantumType: " &$objItem.QuantumType & @CRLF
    $Output&="RegisteredUser: " &$objItem.RegisteredUser & @CRLF
    $Output&="SerialNumber: " &$objItem.SerialNumber & @CRLF
    $Output&="ServicePackMajorVersion: " &$objItem.ServicePackMajorVersion & @CRLF
    $Output&="ServicePackMinorVersion: " &$objItem.ServicePackMinorVersion & @CRLF
    $Output&="SizeStoredInPagingFiles: " &$objItem.SizeStoredInPagingFiles & @CRLF
    $Output&="Status: " &$objItem.Status & @CRLF
    $Output&="SystemDevice: " &$objItem.SystemDevice & @CRLF
    $Output&="SystemDirectory: " &$objItem.SystemDirectory & @CRLF
    $Output&="TotalSwapSpaceSize: " &$objItem.TotalSwapSpaceSize & @CRLF
    $Output&="TotalVirtualMemorySize: " &$objItem.TotalVirtualMemorySize & @CRLF
    $Output&="TotalVisibleMemorySize: " &$objItem.TotalVisibleMemorySize & @CRLF
    $Output&="Version: " &$objItem.Version & @CRLF
    $Output&="WindowsDirectory: " &$objItem.WindowsDirectory & @CRLF
    If Msgbox(1, "WMI-Ausgabe", $Output)=2 then ExitLoop
    $Output=""
    Next
    Else
    Msgbox(0, "WMI-Ausgabe","Keine WMI-Objekte gefunden für Klasse: " & "Win32_OperatingSystem")
    Endif

    [/autoit] [autoit][/autoit] [autoit]

    Func WMIDateStringToDate($dtmDate)
    Return (StringMid($dtmDate, 5, 2) &"/" &StringMid($dtmDate, 7, 2) &"/" &StringLeft($dtmDate, 4) & " " &StringMid($dtmDate, 9, 2) &":" &StringMid($dtmDate, 11, 2) &":" &StringMid($dtmDate,13, 2))
    EndFunc

    [/autoit]