Jump to content

Recommended Posts

Posted

Hello!

Can anyone tell me if it is possible to pull the logged on user's "Full Name" account information from Windows XP Pro? I know about the @ComputerName & @UserName functions but I need the logged on user's First name and Last name. Is there a way to get that information without haveing to rely on the user inputing that information??

Thanks in advance.

Have a wonderful Holiday!! :P

Posted

You can use SvenP WMI ScriptOMatic tool to get any information from the system.

; 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_UserAccount", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "AccountType: " & $objItem.AccountType & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "Disabled: " & $objItem.Disabled & @CRLF
      $Output = $Output & "Domain: " & $objItem.Domain & @CRLF
      $Output = $Output & "FullName: " & $objItem.FullName & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LocalAccount: " & $objItem.LocalAccount & @CRLF
      $Output = $Output & "Lockout: " & $objItem.Lockout & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "PasswordChangeable: " & $objItem.PasswordChangeable & @CRLF
      $Output = $Output & "PasswordExpires: " & $objItem.PasswordExpires & @CRLF
      $Output = $Output & "PasswordRequired: " & $objItem.PasswordRequired & @CRLF
      $Output = $Output & "SID: " & $objItem.SID & @CRLF
      $Output = $Output & "SIDType: " & $objItem.SIDType & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_UserAccount" )
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
AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line
Posted

I don't think you can get a persons identity just from them logging on .... you don't enter that info anywhere.... you can get there username and computer name but not there real name :/

tolle indicium

Posted

You can use SvenP WMI ScriptOMatic tool to get any information from the system.

; 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_UserAccount", "WQL", _
                                          $wbemFlagReturnImmediately + $wbemFlagForwardOnly)

If IsObj($colItems) then
   For $objItem In $colItems
      $Output = $Output & "AccountType: " & $objItem.AccountType & @CRLF
      $Output = $Output & "Caption: " & $objItem.Caption & @CRLF
      $Output = $Output & "Description: " & $objItem.Description & @CRLF
      $Output = $Output & "Disabled: " & $objItem.Disabled & @CRLF
      $Output = $Output & "Domain: " & $objItem.Domain & @CRLF
      $Output = $Output & "FullName: " & $objItem.FullName & @CRLF
      $Output = $Output & "InstallDate: " & WMIDateStringToDate($objItem.InstallDate) & @CRLF
      $Output = $Output & "LocalAccount: " & $objItem.LocalAccount & @CRLF
      $Output = $Output & "Lockout: " & $objItem.Lockout & @CRLF
      $Output = $Output & "Name: " & $objItem.Name & @CRLF
      $Output = $Output & "PasswordChangeable: " & $objItem.PasswordChangeable & @CRLF
      $Output = $Output & "PasswordExpires: " & $objItem.PasswordExpires & @CRLF
      $Output = $Output & "PasswordRequired: " & $objItem.PasswordRequired & @CRLF
      $Output = $Output & "SID: " & $objItem.SID & @CRLF
      $Output = $Output & "SIDType: " & $objItem.SIDType & @CRLF
      $Output = $Output & "Status: " & $objItem.Status & @CRLF
      if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
      $Output=""
   Next
Else
   Msgbox(0,"WMI Output","No WMI Objects Found for class: " & "Win32_UserAccount" )
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

Danny35d,

Thank you!! :) This will definatly help me...plus, will help me with other projects! :P

:D

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
  • Recently Browsing   0 members

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