Jump to content

Running network programs that need auth


Recommended Posts

no, i havent tried that yet.

i will monday when i get to work

it seems to me that it is just not authenticating the way i think it should...mayby i was wrong to put the 2 option in runasset

;Set privlages if needed
If IniRead($settings, "Program_Use_Only", "NetLogon", "0") = 1 Then RunAsSet($netuser, $netdom, $netpass, 2)

it also kind of bothered me that drivemapadd wouldn't work with my wsc_domain\ACalcutt account either

If a child program is started with Run + RunAsSet it's like a there's new login session with the child process as the solitary user. Network connections have to be initiated again for the child process itself, it doesn't inherit anything from the parent session because now it's another user. DriveMapAdd will work, but only if it's being called by the child process, i.e. if the child is an AutoIt script, too.

Basically, all the calls to Run that take advantage of the RunAsSet need to be moved to a child script and preceeded with the call to DriveMapAdd, or you can add a mechanism to have the original script re-run itself with the RunAsSet credentials; I used a simple method to do this in the thread that I linked above, and UDFs have been posted in Scripts-and-Scraps for doing this as well...

Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Link to comment
Share on other sites

well...i tried this instead which seems to be working, i'll just make it into a function

If StringInStr($cleansms_exe, "\\") Then
    $count=2
    While 1
        $count+=1
        If StringInStr ($cleansms_exe, "\" , 0, $count) = 0 Then ExitLoop
    WEnd
    $count-=1
    $exe = StringTrimLeft($cleansms_exe, StringInStr($cleansms_exe, "\", 0, $count))        
    Send("#r")
    ControlSetText("Run", "", "Edit1", $cleansms_exe)
    ControlClick("Run", "", "Button2")
    While ProcessExists($exe) = 0
        If WinExists("Connect to") Then
            ControlSetText("Connect to", "", "Edit2", $netdom & "\" & $netuser)
            ControlSetText("Connect to", "", "Edit3", $netpass)
            ControlClick("Connect to", "", "Button2")
        EndIf
    WEnd
    ProcessWaitClose($exe)
Else
    RunWait($cleansms_exe);Run CleanSMS
EndIf
Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

Link to comment
Share on other sites

Well, here is my final function if anyone runs into the same problem, but i would still be interested in a true solution

Func _RunNetSupport($fullpath_exe, $netuser, $netpass, $netdom)
    AutoItSetOption ( "RunErrorsFatal", 0)
    $error=0
;-->get exe filename
    $count=2
    While 1;find last "\" location + 1
        $count+=1
        If StringInStr ($fullpath_exe, "\" , 0, $count) = 0 Then ExitLoop
    WEnd
    $count-=1
    $exe = StringTrimLeft($fullpath_exe, StringInStr($fullpath_exe, "\", 0, $count));exe filename

;-->Run Program
    If StringInStr($fullpath_exe, "\\") Then; if a netowrk location
        Send("#r");open runbox
        WinWaitActive("Run")
        ControlSetText("Run", "", "Edit1", $fullpath_exe); run exe in runbox
        ControlClick("Run", "", "Button2")
        While ProcessExists($exe) = 0
            If WinExists("Connect to") Then; if asked for credentials
                ControlSetText("Connect to", "", "Edit2", $netdom & "\" & $netuser)
                ControlSetText("Connect to", "", "Edit3", $netpass)
                ControlClick("Connect to", "", "Button2")
            EndIf
            If WinExists($fullpath_exe, "") Then
                ControlClick($fullpath_exe, "", "Button1")
                If WinExists("Run") Then ControlClick("Run", "", "Button3")
                $error=1
                ExitLoop
            EndIf
        WEnd
        If $error <> 1 Then ProcessWaitClose($exe);wait umtill program closes
    Else
        RunWait($fullpath_exe);Run Program
        If @error=1 Then $error=1
    EndIf
    If $error=1 Then
            msgbox(0, "Error", $exe & " location invalid, Please choose the correct location")
            $fullpath_exe = FileOpenDialog($exe & " Location", $workingdir, "AutoInstall (*.exe;*.bat)", 1 + 4)
            _RunNetSupport($fullpath_exe, $netuser, $netpass, $netdom)
    EndIf
EndFunc
Edited by ACalcutt

Andrew Calcutt

Http://www.Vistumbler.net

Http://www.TechIdiots.net

Its not an error, its a undocumented feature

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