Jump to content

RunAsSet() and @error


Recommended Posts

Hello,

I am having some issues with RunAsSet()

I am trying to run an executable with user provided credentials

First I

opt("RunErrorsFatal", 0)oÝ÷ Ù8^k¢jm¶®±êߢ»ayÊÞuéí©ljëh×6
$ptrPromptWindow = GUICreate("Enter Account Information:", $intWindowWidth, $intWindowHeight, -1, -1)
    GUICtrlCreateGroup("Account:", 10, $intRow, $intWindowWidth-20, $intWindowGroupHeight)
    $intRow += 30
    GUICtrlCreateLabel("Username:", 15, $intRow, 60)
    $ptrUserName = GUICtrlCreateInput("", 85, $intRow, 300)
    
    $intRow += 30
    GUICtrlCreateLabel("Password:", 15, $intRow, 60)
    $ptrPassword = GUICtrlCreateInput("", 85, $intRow, 300,-1, $ES_PASSWORD)
    
    $intRow += 30
    GUICtrlCreateLabel("Domain:", 15, $intRow, 60)
    $ptrDomain = GUICtrlCreateInput(@LogonDomain, 85, $intRow, 300)
    
    $intRow += 40
    $buttonOK = GUICtrlCreateButton("OK", $intWindowWidth/2 - 50, $intRow, 40)
    $buttonCancel = GUICtrlCreateButton("Cancel", $intWindowWidth/2 + 10, $intRow, 40)
    
    GUISetState(@SW_SHOW, $ptrPromptWindow)
    
    While 1
        $msg = GUIGetMsg()
        
        Switch $msg
            Case $buttonOK
                $strUserName = GUICtrlRead($ptrUserName)
                $strPassword = GUICtrlRead($ptrPassword)
                $strDomain = GUICtrlRead($ptrDomain)
                ExitLoop
            Case $buttonCancel, $GUI_EVENT_CLOSE
                $boolCanceled = True
                ExitLoop
        EndSwitch
    WEnd
oÝ÷ Ù8^hi§Äµ«­¢+Ø)IÕ¹ÍMÐ ÀÌØíÍÑÉUÍɹµ°ÀÌØíÍÑɽµ¥¸°ÀÌØíÍÑÉAÍÍݽɰĤ(oÝ÷ Ù©Ý!z·¢²Ø^~éâ·¥
+'ȺÇë®Úv{¬z»ajØZ²Z çhÚ-+&iÈbæ­¢w©¢)í½êâ·¥z-Âä~ÚWh¨§ºÇ«±hZ¶Æ޲ج¶­zºè®­²Ç­¶7ß}ÀqÊ+v)à¶ayÚºg§µ«b¢z®¢×ºq+®ì«Z'­²'íë®*m².Û^®h§j×°ØZ}«Zê뢸i§ý§Y¨­~éܶ*'}¨¥±Û¶Úv­ÏßW§¢×èºw§e¢§ ;5

Does anyone know what @error = 0 means or why this will not work with domain users?

Link to comment
Share on other sites

Ok, so I figured out that RunSetAs() will return @error to 0 which is why i got 0

But I am still not sure why RunAsSet will not work for domain users?

I can right-click on a file and choose Run As... and use any domain user I want, what is the difference?

Link to comment
Share on other sites

I'm trying to understand better what you are trying to do but unfortunately I'm missing something. When you say domain users do you mean users with no rights to the machine? If you go into computer management then users do you see the user you want to run as? I work in novell winxp enviornment so if I can recreate the results I might be able to help, but can you be more specific?

Can you explain a little bit more about the overview of your script? What are you using runasset for?

Edited by someone
While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd
Link to comment
Share on other sites

ok, I am talking active directory domain users. They will not be in the local users section. I do have a group they belong to in the administrators group.

Now what i am trying to do is prompt for any user account on our Active Directory domain (all users have atleast login rights on all computers)

Then it will open a box that you can drag an executable file to, and it will run with the supplied credentials.

Example:

1. User is prompted for Username, Password, and Domain

-Username: Bob

-Password: pass

-Domain: ourDomain

2. Set runasset to those credentials:

RunAsSet("Bob", "ourDomain", "pass", 1)oÝ÷ Ûs©z|"Ú0²ØZ·¥§z_W¬v¶ çhÚ"·¡zwâè¬v¶ çhÚ£ayø¥{¥·«j|"¶ay§¢éí²øv)ìµêvjëh×6Run("Dragged File")
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...