Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Start a script as administartor from within a script (Batch)

$
0
0
Hi,

I have a Batch script that is started remotely from one computer(PC-X)  on another(PC-A).

Now within the script tat is running on the PC-A I want to triger another Batch script  (or command) with administartive privileges.
Everey thing I tried till now failed.

I now stick on the Evelate Tools: Elevate Tools

But I also Fail:

Script A:

 
D:
CD D:\ElevDir
@Echo Parent Script>> D:\elev.txt
Elevate32 -s 1 -d D:\ElevDir cmd.exe /c D:\ElevDir\Cmd_Tracer.bat
@Echo Parent Script>> D:\elev.txt

Script B:

@Echo OFF
D:
CD D:\ElevDir
@Echo Child Script >> D:\elev.txt
for /F "TOKENS=1,2,*" %%a in ('tasklist /FI "IMAGENAME eq MyProcess.exe"') do set MyPID=%%b
@Echo %MyPID% >>  D:\elev.txt
@Echo Child Script >> D:\elev.txt

When I run it manually it allways prompts me for a UAC, but this is not wanted during a automated execution ...
I'think I missing something basic ...


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>