Restart Service with admin privileges(Task Scheduler) - service

I have a batch file which restarts a service.
net stop "Spider"
net start "Spider"
I execute this with admin privileges as "Run as administrator" without problem, but when I try to schedule this with "Task Scheduler" I am getting an error 0x2.
This is how I configurate task scheduler, even with "run with highest privileges" I can't execute it. The user dferre is an administrator.

Related

Jenkins couldn't run exe installer

Created Jenkins job to run silent installation of my application, the application installer is exe file.
tried with Windows Exe Runner - setup.exe /s
tried with PowerShell job - - setup.exe /s
In both cases I get the same issue:
System.InvalidOperationException: Showing a modal dialog box or form when the application is not running in UserInteractive mode is not a valid operation. Specify the ServiceNotification or DefaultDesktopOnly style to display a notification from a service application.
If I run the command manually on the machine from PS run as administrator it will silently install my application in the background without errors.
Suppose it is problem with Jenkins privileges on the server machine, Jenkins is run as a service using Admin credentials.

Jenkins Can't Run Powershell IIS Script as Admin

I have some jenkins powershell IIS scripts. I need to run them as admin in jenkins pipeline to make it work. When I try it from jenkins it gives me "Error: Cannot read configuration file due to insufficient permissions". But when I run it from my local ps as admin, it works perfectly. How can I resolve this issue? Thanks!

flutter desktop (window) request administrator on launch

I need to run a command line that required administrator privilege. I use Process class from dart.io file to run the command... but I don't want to always request administrator if I need to execute a command that required administrator. do you have anything about my problem?

Is it possible to run Copy-VMFile powershell command as non-admin?

I have a host machine with Hyper-V enabled, and I have a Hyper-V guest running on this machine. Becauze I can't drag&drop files to the VM, I wrote a script to do this for me, which is integrated in TotalCommander, and which uses Copy-VMFile.
My problem is that the PS script works only if I run it as admin, otherwise I get the error "You do not have the required permission to complete this task."
Why do I need admin to copy from the host machine to the guest OS? And is there a way, some policy which would allow me to circumvent this? It is annoying to enter a password every time I want to copy some files.

Logon failure in running a windows service

I am running a service called prunner on windows server 2012. I used the command sc to change the username and the password of the service:
sc.exe config myService obj= "sqa265\hero" password= "hero1"
The output of the command is saying that it have succeed but when I go to task manager in order to start the service I get: logon failure!!!
I tried to run the sc command under the user hero and under the user administrator but I still get the same error. But the very strange thing is that if I do the same thing manually via the task manager and service control pane I success and the service go to the state:running!!! But I need to automate this thing, so please any help?
You need to give the account "sqa265\hero" the SeServiceLogonRight permission. As you have noticed setting the credentials up through the control panel works, but what you might not have noticed is that if you tried to use the command line after using the control panel.
You can test this by setting the service back to the Local System account in the control panel, and then running your command-line again.
To fix this from a script, you can use the NTRights utility outlined in this MS knowledgebase article:
http://support.microsoft.com/kb/315276
After you install NTRights, you can run it like this:
NTRights.exe +r SeServiceLogonRight -u "sqa265\hero"
Combined with the sc config commandline you already have, the service should run with those credentials.
Further reading:
http://www.techrepublic.com/article/set-user-rights-using-the-ntrights-utility/5032903