Jump to content

Recommended Posts

Posted

hello, i want to create a program that finds the right admin or an admin with password so i can run a program with administrative privileges, some of the computers has admin as administrator admin principal etc.

here is the code:

Local $colUsers, $sTmp, $Array[1] = ["user"]
$colUsers = ObjGet("WinNT://" & @ComputerName)
If IsObj($colUsers) Then
    $colUsers.Filter = $Array
    For $objUser In $colUsers
        $sTmp &= $objUser.Name & @LF
  If $objUser.Name = "Administrador" Then
   MsgBox(0, "Users", "found" & $objUser.Name)
   runadmin($objUser.Name)
  ElseIf $objUser.Name = "Administrator" Then
   MsgBox(0, "Users", "found will run with: " & $objUser.Name)
   runadmin($objUser.Name)
  ElseIf $objUser.Name = "Admin" Then
   MsgBox(0, "Users", "found" & $objUser.Name)
   runadmin($objUser.Name)
  ElseIf $objUser.Name = "Principal" Then
   MsgBox(0, "Users", "found" & $objUser.Name)
   runadmin($objUser.Name)
  EndIf
    Next
EndIf
MsgBox(0, "Users", $sTmp)

Func runadmin($username)
RunAs($username, @ComputerName, "heyapple", 0, "runastest.exe")
MsgBox(0, "Users", "cree")
EndFunc

i want to make sure i send a valid admin with the correct password so the program doesnt fail in its task

Posted

try with this dos command and parse the result

"net localgroup administrators"

bye

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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...