ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Coding Snacks

[Solved by 4wd] Tool to let me execute Programs with chooseable permission [Ty!]

<< < (2/2)

KodeZwerg:
Sorry my fault, you have no testing Application, just a resulting Application from Post #2.
I've attached a Demo Application that execute "Batch.bat".
Two modes in Demo are supported, the first called forced privileges, in that mode i want to achieve "IsElevated = False".

Three non-working examples included in Batch.bat.

If someone find out how, please let me know! Thank you for support!
You will need those files:
RunAsTester.exe (from Post #2)
RunAsDemo.exe (inside this archive)
Batch.bat (inside this archive)

Please edit Path inside Batch.bat to your Filesystem before loading RunAsDemo.exe.
The RunAsDemo.exe will not require admin privileges at start, all managed from within Demo.

4wd:
It seems that the recommended way to start a non-elevated command from an elevated session is to use the Task Scheduler:

From here:

--- Code: PowerShell ---<#  Run-NonEl.ps1#> function Run-NonElevated( [string] $cmd ) {    $task_name = "Run-NonElevated-$(New-Guid)"    schtasks /Create /RU $Env:USERNAME /TN $task_name /SC ONCE /ST 00:00 /F /TR $cmd    schtasks /run /tn $task_name    schtasks /delete /F /tn $task_name} Run-NonElevated "%WINDIR%\System32\cmd.exe /C K:\RunAsTester.exe"
Which gives this from an elevated PowerShell console:
.\Run-NonEl.ps1
[Solved by 4wd] Tool to let me execute Programs with chooseable permission [Ty!]


And the following from an elevated PowerShell console:
C:\Windows\System32\cmd.exe /C K:\RunAsTester.exe
[Solved by 4wd] Tool to let me execute Programs with chooseable permission [Ty!]

So it appears to work.

KodeZwerg:
Hello 4wd,

in reply to your last Post, yeah, this sound reproducable to me and will solve my issue with Windows and privileges.
A new hunt for me begun to figure out "how-to" delphi that, thanks alot for your help!

Navigation

[0] Message Index

[*] Previous page

Go to full version