Jump to content

Recommended Posts

Posted (edited)

What approch would u use to find out what OS a remote computer is running on?

I guess there are som easy way to detect that even if i havent found it yet.

//Regards Lasse

Edited by lgvlgv
Posted

It depends on your environment. If you have Active Directory you can query the AD for the OS information of the domain member.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Posted

WMI is your friend. I was using Scriptomatic (for download please search the Example Scripts section) to generate the following code:

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet("winmgmts:" & $strComputer & "")
$colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "BootDevice: " & $objItem.BootDevice & @CRLF
      $Output = $Output & "BuildNumber: " & $objItem.BuildNumber & @CRLF
      $Output = $Output & "BuildType: " & $objItem.BuildType & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "CodeSet: " & $objItem.CodeSet & @CRLF
      $Output = $Output & "CountryCode: " & $objItem.CountryCode & @CRLF
      $Output = $Output & "CreationClassName: " & $objItem.CreationClassName & @CRLF
      $Output = $Output & "CSCreationClassName: " & $objItem.CSCreationClassName & @CRLF
      $Output = $Output & "CSDVersion: " & $objItem.CSDVersion & @CRLF
      $Output = $Output & "CSName: " & $objItem.CSName & @CRLF
      $Output = $Output & "CurrentTimeZone: " & $objItem.CurrentTimeZone & @CRLF
      $Output = $Output & "DataExecutionPrevention_32BitApplications: " & $objItem.DataExecutionPrevention_32BitApplications & @CRLF
      $Output = $Output & "DataExecutionPrevention_Available: " & $objItem.DataExecutionPrevention_Available & @CRLF
      $Output = $Output & "DataExecutionPrevention_Drivers: " & $objItem.DataExecutionPrevention_Drivers & @CRLF
      $Output = $Output & "DataExecutionPrevention_SupportPolicy: " & $objItem.DataExecutionPrevention_SupportPolicy & @CRLF
      $Output = $Output & "Debug: " & $objItem.Debug & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "Distributed: " & $objItem.Distributed & @CRLF
      $Output = $Output & "EncryptionLevel: " & $objItem.EncryptionLevel & @CRLF
      $Output = $Output & "ForegroundApplicationBoost: " & $objItem.ForegroundApplicationBoost & @CRLF
      $Output = $Output & "FreePhysicalMemory: " & $objItem.FreePhysicalMemory & @CRLF
      $Output = $Output & "FreeSpaceInPagingFiles: " & $objItem.FreeSpaceInPagingFiles & @CRLF
      $Output = $Output & "FreeVirtualMemory: " & $objItem.FreeVirtualMemory & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LargeSystemCache: " & $objItem.LargeSystemCache & @CRLF
      $Output = $Output & "LastBootUpTime: " & WMIDateStringToDate($objItem.LastBootUpTime) & @CRLF
      $Output = $Output & "LocalDateTime: " & WMIDateStringToDate($objItem.LocalDateTime) & @CRLF
      $Output = $Output & "Locale: " & $objItem.Locale & @CRLF
      $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
      $Output = $Output & "MaxNumberOfProcesses: " & $objItem.MaxNumberOfProcesses & @CRLF
      $Output = $Output & "MaxProcessMemorySize: " & $objItem.MaxProcessMemorySize & @CRLF
      $strMUILanguages = $objItem.MUILanguages(0)
      $Output = $Output & "MUILanguages: " & $strMUILanguages & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "NumberOfLicensedUsers: " & $objItem.NumberOfLicensedUsers & @CRLF
      $Output = $Output & "NumberOfProcesses: " & $objItem.NumberOfProcesses & @CRLF
      $Output = $Output & "NumberOfUsers: " & $objItem.NumberOfUsers & @CRLF
      $Output = $Output & "OperatingSystemSKU: " & $objItem.OperatingSystemSKU & @CRLF
      $Output = $Output & "Organization: " & $objItem.Organization & @CRLF
      $Output = $Output & "OSArchitecture: " & $objItem.OSArchitecture & @CRLF
      $Output = $Output & "OSLanguage: " & $objItem.OSLanguage & @CRLF
      $Output = $Output & "OSProductSuite: " & $objItem.OSProductSuite & @CRLF
      $Output = $Output & "OSType: " & $objItem.OSType & @CRLF
      $Output = $Output & "OtherTypeDescription: " & $objItem.OtherTypeDescription & @CRLF
      $Output = $Output & "PAEEnabled: " & $objItem.PAEEnabled & @CRLF
      $Output = $Output & "PlusProductID: " & $objItem.PlusProductID & @CRLF
      $Output = $Output & "PlusVersionNumber: " & $objItem.PlusVersionNumber & @CRLF
      $Output = $Output & "Primary: " & $objItem.Primary & @CRLF
      $Output = $Output & "ProductType: " & $objItem.ProductType & @CRLF
      $Output = $Output & "RegisteredUser: " & $objItem.RegisteredUser & @CRLF
      $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF
      $Output = $Output & "ServicePackMajorVersion: " & $objItem.ServicePackMajorVersion & @CRLF
      $Output = $Output & "ServicePackMinorVersion: " & $objItem.ServicePackMinorVersion & @CRLF
      $Output = $Output & "SizeStoredInPagingFiles: " & $objItem.SizeStoredInPagingFiles & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      $Output = $Output & "SuiteMask: " & $objItem.SuiteMask & @CRLF
      $Output = $Output & "SystemDevice: " & $objItem.SystemDevice & @CRLF
      $Output = $Output & "SystemDirectory: " & $objItem.SystemDirectory & @CRLF
      $Output = $Output & "SystemDrive: " & $objItem.SystemDrive & @CRLF
      $Output = $Output & "TotalSwapSpaceSize: " & $objItem.TotalSwapSpaceSize & @CRLF
      $Output = $Output & "TotalVirtualMemorySize: " & $objItem.TotalVirtualMemorySize & @CRLF
      $Output = $Output & "TotalVisibleMemorySize: " & $objItem.TotalVisibleMemorySize & @CRLF
      $Output = $Output & "Version: " & $objItem.Version & @CRLF
      $Output = $Output & "WindowsDirectory: " & $objItem.WindowsDirectory & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_OperatingSystem" )
Endif


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

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...