Jump to content

Recommended Posts

  • Developers
Posted (edited)

Is there a way to call an in-built function (ie drivemapadd) from a Run(..) or Runwait(..) ?? This would cause the drivemapadd() to be called with the necessary RunAsSet credentials.

This scriptlet will let the script restart itself with the specified credentials..

AutoItSetOption("RunErrorsFatal", 0) 
AutoItSetOption("TrayIconHide", 1) 
Break(0)
$USERNAME = "Administrator"
$PASSWORD = "Secret"
$RUN = 0     ; run indicator 
; retrieve the cycle from commandline
If $CMDLINE[0] = 1 Then $RUN = $CMDLINE[1]
If $RUN = 0 Then
   RunAsSet($USERNAME, @ComputerName, $PASSWORD)
   Run('"' & @ScriptFullPath & '" " 1"') 
   If @error Then MsgBox(4096+32,"Error", "Error starting under admin mode")
   Exit
EndIf
; commands go here that require Administrator rights
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Posted (edited)

The ap.exe CAN NOT be ran from a UNC path. What I'm taking from what your reading is to just make the working directory that of the unc path and then running the cmd. This will not work. Also drivemapadd() will not work for me either because I need to do all of this in a RunAsSet. ...unlesss...........

Is there a way to call an in-built function (ie drivemapadd) from a Run(..) or Runwait(..) ?? This would cause the drivemapadd() to be called with the necessary RunAsSet credentials.

DriveMapAdd( "device", "remote share" [, flags [, "user" [, "password"]]] )

device

The device to map, for example "O:" or "LPT1:". If you pass a blank string for this parameter a connection is made but not mapped to a specific drive. If you specify "*" an unused drive letter will be automatically selected. remote share The remote share to connect to in the form "\\server\share".

flags [optional]

A combination of the following:

0 = default

1 = Persistant mapping

8 = Show authentication dialog if required

user [optional] The username to use to connect. In the form "username" or "domain\username".

password [optional] The password to use to connect.

So i don't realy know why you are saying that DriveMapAdd can't be use with RunAsSet.. just use variables so the user/password you set for RunAsSet also works for DriveMapAdd...

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Posted

DriveMapAdd( "device", "remote share" [, flags [, "user" [, "password"]]] )

user [optional] The username to use to connect. In the form "username" or "domain\username". password [optional] The password to use to connect.

So i don't realy know why you are saying that DriveMapAdd can't be use with RunAsSet.. just use variables so the user/password you set for RunAsSet also works for DriveMapAdd...

DUH!... I knew I was missing something. I'm already pulling in username and pass to the RunAsSet with variables, that only makes sense..thank you

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...