Old 1st May 2020, 16:33   #1
RainerHH
Junior Member
 
Join Date: Apr 2020
Posts: 22
nsExec with Admin rights

I use nsExec::ExecToStack /OEM
to execute a command line instruction.

But the program refuses to run because it does not have administrator privileges.

What can I do?
RainerHH is offline   Reply With Quote
Old 1st May 2020, 21:51   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,275
Ideally you should use "RequestExecutionLevel Admin" to make the installer elevate if you intend to run any child processes elevated.

nsExec can't elevate because its reason to exist is to handle stdout and to elevate it would have to call ShellExecuteEx and then you lose control over stdout. It could theoretically be done by using a extra helper process but the plug-in does not currently support that.

Your best bet is to use ExecShellWait with the "runas" verb. You lose control over stdout and elevation will NOT work if UAC has been turned off and it might not elevate on < Vista.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 1st May 2020, 23:12   #3
RainerHH
Junior Member
 
Join Date: Apr 2020
Posts: 22
thank you
RequestExecutionLevel Admin
works!
RainerHH is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump