Sign in to follow this  
Followers 0
tsue

find the right admin

2 posts in this topic

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

Share this post


Link to post
Share on other sites

try with this dos command and parse the result

"net localgroup administrators"

bye


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

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