Jump to content

Recommended Posts

Posted

I cannot work out how to use RunAsWait, or even just Run to execute the following command:

"net use s: \\servername\share".

I have tried:

Runaswait($sUserName, @LogonDomain, $sPassword, 0, @COMSPEC & "/c" & "net use x: \\server\share" )

where $sUsername and $sPassword are correct for Domain Admin.,

Runwait(@COMSPEC & "/c" & "net use x: \\server\share")

and many other formats and all appear to return error 1.

How can I set up a mapped drive for a RunAs user within an AutoIt script. This is critical for the running of a Hospice medical application and is becoming urgent.

Posted

Run(@ComSpec & " /c " & 'net use s: \\servername\share\' , "", @SW_HIDE)
Thank you for the prompt response but unfortunately this doesn't resolve my problem.

I need to map the drive as another user (with domain admin rights) and then execute a program with the same admin rights. This is waht I currently have in a test scritpt and it doesn't work:

RunAsWait($sUserName, @LogonDomain, $sPassword, 0, @ComSpec & " /c " & 'net use y: \\gcsrv02\AEGIS\ /persistent:yes' , "", @SW_HIDE)RunAsWait($sUserName, @LogonDomain, $sPassword, 0, "notepad.exe y:test.csv", "",@SW_MAXIMIZE )

The notepad execution cannot find the test.csv because the drive is not mapped at that time.

Any further help would be appreciated.

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