Sign in to follow this  
Followers 0
Kudzu309

Simplest way to determine a remote OS?

4 posts in this topic

I can't find a built-in function (in v3.3) to determine a remote machine's operating system. What is the simplest way to determine this accurately? Also, the account I'm using does have administrative access to the remote machines, if that helps.

Thanks in advance!

Share this post


Link to post
Share on other sites



Hi,

one simple way would be putting a script on a share which provides the/any info.

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

I can't find a built-in function (in v3.3) to determine a remote machine's operating system. What is the simplest way to determine this accurately? Also, the account I'm using does have administrative access to the remote machines, if that helps.

Thanks in advance!

I'm new to AutoIt so unfortunately I don't know of a method of doing this with just AutoIt itself, but personally I'm a fan of combining multiple tools to suit a particular task. In this case, I would probably use something like nmap:

http://nmap.org/

It does a really good job of identifying the remote OS. It's also just an incredibly handy app to have around.

Hope that helped.

Share this post


Link to post
Share on other sites

You can use WMI if its an all Windows environment:

; Generated by AutoIt Scriptomatic

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

$Output=""
$Output = $Output & "Computer: " & $strComputer  & @CRLF
$Output = $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 = $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
      $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 & "Organization: " & $objItem.Organization & @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 & "PlusProductID: " & $objItem.PlusProductID & @CRLF
      $Output = $Output & "PlusVersionNumber: " & $objItem.PlusVersionNumber & @CRLF
      $Output = $Output & "Primary: " & $objItem.Primary & @CRLF
      $Output = $Output & "ProductType: " & $objItem.ProductType & @CRLF
      $Output = $Output & "QuantumLength: " & $objItem.QuantumLength & @CRLF
      $Output = $Output & "QuantumType: " & $objItem.QuantumType & @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

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0