Jump to content

Authentication Problem.


Recommended Posts

I am currently using the following script to collect bios information from XP PC`s over the network. The script fails because I need to authenticate as another user. I am not sure how to change the script so what it will prompt me for a username, password and domain and then use the details to authenticate to the other pc.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:        A.N.Other <myemail@nowhere.com>
;
; Script Function:
;   Template AutoIt script.
;
; ----------------------------------------------------------------------------
; Script Start - Add your code below here

; Generated by AutoIt Scriptomatic

$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = InputBox("Information","Computer Name or IP","localhost")

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

If IsObj($colItems) then
   For $objItem In $colItems
      $strBiosCharacteristics = $objItem.BiosCharacteristics(0)
      $Output = $Output & "BiosCharacteristics: " & $strBiosCharacteristics & @CRLF
      $strBIOSVersion = $objItem.BIOSVersion(0)
      $Output = $Output & "BIOSVersion: " & $strBIOSVersion & @CRLF
      $Output = $Output & "BuildNumber: " & $objItem.BuildNumber & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "CodeSet: " & $objItem.CodeSet & @CRLF
      $Output = $Output & "CurrentLanguage: " & $objItem.CurrentLanguage & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "IdentificationCode: " & $objItem.IdentificationCode & @CRLF
      $Output = $Output & "InstallableLanguages: " & $objItem.InstallableLanguages & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LanguageEdition: " & $objItem.LanguageEdition & @CRLF
      $strListOfLanguages = $objItem.ListOfLanguages(0)
      $Output = $Output & "ListOfLanguages: " & $strListOfLanguages & @CRLF
      $Output = $Output & "Manufacturer: " & $objItem.Manufacturer & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "OtherTargetOS: " & $objItem.OtherTargetOS & @CRLF
      $Output = $Output & "PrimaryBIOS: " & $objItem.PrimaryBIOS & @CRLF
      $Output = $Output & "ReleaseDate: " & WMIDateStringToDate($objItem.ReleaseDate) & @CRLF
      $Output = $Output & "SerialNumber: " & $objItem.SerialNumber & @CRLF
      $Output = $Output & "SMBIOSBIOSVersion: " & $objItem.SMBIOSBIOSVersion & @CRLF
      $Output = $Output & "SMBIOSMajorVersion: " & $objItem.SMBIOSMajorVersion & @CRLF
      $Output = $Output & "SMBIOSMinorVersion: " & $objItem.SMBIOSMinorVersion & @CRLF
      $Output = $Output & "SMBIOSPresent: " & $objItem.SMBIOSPresent & @CRLF
      $Output = $Output & "SoftwareElementID: " & $objItem.SoftwareElementID & @CRLF
      $Output = $Output & "SoftwareElementState: " & $objItem.SoftwareElementState & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      $Output = $Output & "TargetOperatingSystem: " & $objItem.TargetOperatingSystem & @CRLF
      $Output = $Output & "Version: " & $objItem.Version & @CRLF
      if Msgbox(1,"WMI Output Information",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_BIOS" )
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

The code has been taken from Scriptomatic and I have tested it againt PC`s that accept my default login. Works fine.

I desparetly need this to work asap, any advice/help would be greatly valued.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...