"process" should appear once in the command.
Can you try the same command with notepad.exe?
Run my exe as admin without prompt?
Re: Run my exe as admin without prompt?
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
Re: Run my exe as admin without prompt?
Yes, that double "process" was a typo that you made. I removed it when trying the real thing. My post of your quote has been edited.skywalk wrote:"process" should appear once in the command.
Can you try the same command with notepad.exe?
This does not launch Notepad either:
Code: Select all
wmic /node:localhost /user:Admin /password:*** process call create "C:\Windows\Notepad.exe"
Re: Run my exe as admin without prompt?
Because you're running it under a different user account (your "admin-user") with highest privileges and the logged in user has no access to it's gui...The scheduled task gets created, and my exe is (apparently) run with admin rights at logon, but it seems to run "silently" in that no window is displayed, it doesn't respond to its hotkeys, its system tray icon doesn't appear
Reduce the procedure to something like this:
Code: Select all
RunAtLogin(taskname$,exe$,elevated=0)
This will create a task for the current logged in user
But I would be very careful about doing it this way. Why?
schtasks uses localized names. E.g. "ONLOGON" is NOT the same
on german, french or other localized installations.
A good way around that is to create a .xml file on the fly, save it and import that
through schtasks. The options in the .xml file can then use the normal english names
and don't need to be localized. In other words: This works fine on all languages...
Re: Run my exe as admin without prompt?
So I did that, and now the exe doesn't run with admin rights under a limited account, which is the whole idea.forumuser wrote:Code: Select all
RunAtLogin(taskname$,exe$,elevated=0)
Re: Run my exe as admin without prompt?
Export the task and show the full .xml content!
Re: Run my exe as admin without prompt?
Here. I changed the computer name, userid and exe details for my privacy.forumuser wrote:Export the task and show the full .xml content!
Maybe if you could post some working code, instead of me just guessing all the time? Because it's obvious that I have no idea what I'm doing here.
Code: Select all
<?xml version="1.0" encoding="UTF-16"?>
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
<RegistrationInfo>
<Date>2018-12-31T19:16:44</Date>
<Author>Computer Name\Admin</Author>
<URI>\Product Name</URI>
</RegistrationInfo>
<Triggers>
<LogonTrigger>
<StartBoundary>2018-12-31T19:16:00</StartBoundary>
<Enabled>true</Enabled>
</LogonTrigger>
</Triggers>
<Principals>
<Principal id="Author">
<UserId>S-1-5-21-2569149087-587176876-3879654987-1203</UserId>
<LogonType>InteractiveToken</LogonType>
<RunLevel>HighestAvailable</RunLevel>
</Principal>
</Principals>
<Settings>
<MultipleInstancesPolicy>IgnoreNew</MultipleInstancesPolicy>
<DisallowStartIfOnBatteries>false</DisallowStartIfOnBatteries>
<StopIfGoingOnBatteries>false</StopIfGoingOnBatteries>
<AllowHardTerminate>false</AllowHardTerminate>
<StartWhenAvailable>false</StartWhenAvailable>
<RunOnlyIfNetworkAvailable>false</RunOnlyIfNetworkAvailable>
<IdleSettings>
<StopOnIdleEnd>false</StopOnIdleEnd>
<RestartOnIdle>false</RestartOnIdle>
</IdleSettings>
<AllowStartOnDemand>true</AllowStartOnDemand>
<Enabled>true</Enabled>
<Hidden>false</Hidden>
<RunOnlyIfIdle>false</RunOnlyIfIdle>
<WakeToRun>false</WakeToRun>
<ExecutionTimeLimit>PT0S</ExecutionTimeLimit>
<Priority>7</Priority>
</Settings>
<Actions Context="Author">
<Exec>
<Command>C:\Path\To\MyApp.exe</Command>
</Exec>
</Actions>
</Task>
Re: Run my exe as admin without prompt?
My tip. As a reasonable provider of an app, you would advise your customers to do without these magic games to save themselves a few clicks. Microsoft didn't introduce the security guidelines for fun.Dude wrote:Thanks for any advice.
If I were a company and a software developer comes up with such suggestions, I would stick his app somewhere else and kick the vendor's ass out of the company premises.
Another tip for you. Please refrain from changing your entry threads all the time. Apart from a few exceptions (e.g. a further developed code in Tips & Tricks) this is not the purpose of a forum.
sorry for my bad english
Re: Run my exe as admin without prompt?
So you're saying it's better that the customer works out how to do that themself, instead of my app providing a way to do it for them? Sounds logical, actually. Would solve a lot of hassle that I'm going through.Josh wrote:As a reasonable provider of an app, you would advise your customers to do without these magic games to save themselves a few clicks.
You mean stop editing my posts? I was just doing that to clarify things, but I will stop in future. I didn't realise it was a problem. Sorry!Josh wrote:Please refrain from changing your entry threads all the time.