Valik Posted September 7, 2006 Posted September 7, 2006 (edited) I'd be very explicit on setting the working directory. You need to make sure it's set to a path the RunAs user can access. For example, if you are running the script from your Desktop, the RunAs user may not have read/write rights to your Desktop but that is what the working directory will be set to.So in other words, don't use @WorkingDir and don't leave the working directory parameter to Run()/RunWait() empty. Explicitly set it to C:\ or the path of the executable, somewhere you know all users have access to.Edit: Couple other things. I see that's kind of what MHz was getting at. It shouldn't be necessary to use FileChangeDir(), though. You definitely must make sure the working directory paramter is set to something the alternate user can access, though.The second thing is Explorer can be started with alternate credentials - I've done it many times. I would say that what lod3n posted is correct. I have Explorer configured as described and I've always been able to get Explorer to launch under alternate credentials either using AutoIt with RunAsSet() or runas from the command line. Edited September 7, 2006 by Valik
lyledg Posted March 8, 2007 Posted March 8, 2007 Hey Guys, I am trying somthing similar in trying to connect to a remote machine's C Drive: Has anyone been able to get a resolution on this, or is it a WinXpSp2 "feature?" Code being used is as follows: expandcollapse popup$Adminform = GUICreate("Logon", 251, 145, -1, -1, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS)) $AdminOkbtn = GUICtrlCreateButton("&OK", 86, 112, 75, 25, 0) $AdminCancelbtn = GUICtrlCreateButton("&Cancel", 167, 112, 75, 25, 0) $Label1 = GUICtrlCreateLabel("Password:", 8, 52, 53, 17) $Label1 = GUICtrlCreateLabel("Administrator:", 8, 18, 67, 17) $ADMININPUT = GUICtrlCreateInput("", 88, 16, 153, 21) GUICtrlSetState(-1, $GUI_FOCUS) $ADMINPSWDINPUT = GUICtrlCreateInput("", 88, 48, 153, 21, BitOR($ES_PASSWORD, $ES_AUTOHSCROLL)) $Label2 = GUICtrlCreateLabel("Domain", 8, 82, 40, 17) $DOMAININPUT = GUICtrlCreateInput("", 88, 80, 153, 21, $ES_UPPERCASE) GUISetState(@SW_SHOW) Global $sADMININPUTrslt =GUICtrlRead($ADMININPUT) Global $sPswdinputrslt = GUICtrlRead($ADMINPSWDINPUT) Global $sDomaininputrslt = GUICtrlRead($DOMAININPUT) Func _ConnectoCdrv() If $sSpecifyMachineName = "" Then MsgBox(16, "Error!", "Machine name is missing.") Else ;Ping machine to see if it contactable $Pingrslt = Ping($sSpecifyMachineName, 300) $Errmsg = @error Select Case $Errmsg = 0 RunAsSet($sADMININPUTrslt, $sDomaininputrslt, $sPswdinputrslt, 2) $Process = Run('Explorer \\' & $sSpecifyMachineName & '\C$', @WindowsDir, @SW_SHOW) Case $Errmsg = 1 MsgBox(16, "Error!", $sSpecifyMachineName & " Host is offline") Return Case $Errmsg = 2 MsgBox(16, "Error!", $sSpecifyMachineName & " Host is unreachable") Return Case $Errmsg = 3 MsgBox(16, "Error!", $sSpecifyMachineName & " Host has a bad destination address") EndSelect EndIf EndFunc
ptrex Posted March 8, 2007 Posted March 8, 2007 @lyledg Why do you need something special Just run this command net use Z: \\Your_PCName\c$ And you will have access (if you hace access rights ofcource) Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now