Cannot start WebMatrix with Administrator privileges at StartUp - startup

Cannot start WebMatrix with Administrator privileges at StartUp.
I already tried:
1) sc create {servicename} binPath={path}
2) schtasks.exe /Create /RU {username} /RP {password} /SC ONLOGON /TN {taskname} /TR {path}

Actually method number 2 is working.
However, the GUI of WebMatrix is not showing up.

Related

how to run jenkins-agent.jnlp at startup as admin

I have downloaded the jenkins-agent.jnlp to windows and created shortcut to windows startup folder.
the agent connected successfully. however when Jenkins trigger cmd, access denied error is occured.
I tried to terminated Jenkins agent and open cmd as admin, run the jenkins-agent.jnlp from cmd then the error is not happend.
How do I execute above automatically instead of manual run cmd as admin then execute the jenkins-agent.jnlp?
Create a task on task scheduler and select user like this.
write administrator name and check the name and create the task as admin.

Visual Studio run Docker project issue

I have a strange situation, if I run a Docker project in Visual Studio 2017 I get an error saying: Cannot start service webapplication1: error while creating mount source path '/host_mnt/c/Users/MyUser/vsdbg/vs2017u5': mkdir /host_mnt/c/Users/MyUser/vsdbg/vs2017u5: permission denied
But, if I run the same project with the command docker-compose up -d it works.
It cannot be a permission issue only for Visual Studio.
I just had the same problem - found the solution at https://github.com/docker/for-win/issues/897
Basically, the problem is access to C:\Users\user\vsdbg - not to think too much I gave R/W access for Everyone to this one and C:\Users\user\.nuget, just in case, and it worked like a charm :)
For me absolutely nothing worked, including giving full rights to only the vsdbg and .nuget folders.
My setup is as follows:
I have a primary account called "User" onto which I'm currently
logged in and do my development work
I have a user called "DockerDiskSharing" with full admin rights,
which I intend to use for Docker to run with
What did the trick for me was:
I opened a command prompt with admin rights and added the DockerDiskSharing user to the docker-users group by running
net localgroups docker-users DockerDiskSharing /add
I went to Docker -> Settings -> Shared Drives, I clicked "Reset credentials" and added the DockerDiskSharing user's credentials. I ticked C drive (my main partition) and the D drive (where my project is located)
I opened a command prompt with admin rights and gave full access permissions to the entire Users/User folder by running:
icacls "C:\Users\User" /q /c /t /grant docker-users:F
Still unsure which folders in particular it needs permissions to read/write to though from Users/User...
For other readers getting here which have a forced setup where their primary windows user can't be local admin:
That doesn't work!
After trying out different workarounds, I gave up. Note that I have a local service account which is local admin. If you don't have that, and are not a local admin, I guess you're screwed.
So:
I reset my Docker shared drive, mounted it again with my primary windows credentials
I added my primary user to the local administrators group
And now it works :)

Ruby -FileUtils creating a directory ,permission denied issue on windows

Am writing a script which creates a directory but when i tried (Ruby script running on windows)
destination = "path to the folder"
FileUtils.mkdir_p destination
it gives me an error saying Permission Denied (Errno::EACCES) at mkdir_p
Any help is appreciated . Thank you
open your cmd terminal with administrator privileges, and then run the script again. It seems like your folder is in a place that need admin privileges, so you can create it. Also add it to your script:
require 'win32ole'
shell = WIN32OLE.new('Shell.Application')
shell.ShellExecute('path_to_ruby_program', nil, nil, 'runas')
And see this two questions:
Run ruby script in elevated mode
Detect if running with administrator privileges under Windows XP

PSEXEC - Elevated Command prompt

Sorry if this has been asked a hundred times, I'm sure it might have been, but my searching skills don't seem to be finding the answer to my particular question today :(
I'm trying to execute a command on a server, from a domain user account, who has all the correct rights to perform the given action. I know this because if I login to the server under the admin account and then open the command prompt using 'Run as different User', specifying the login details of the domain user account, I can perform the relevant section of the below command successfully.
However, when I try running ("c:\NaviTest\psexec.exe" "\HOSTNAME" "c:\path to\server-command.exe" "arguments") from a command prompt on their host computer I get the 'Access Denied' message back.
If I launch the command prompt as administrator and change the syntax of the command as follows (where username is the logged in user and password is their password);
"c:\NaviTest\psexec.exe" -u username -p password "\\HOSTNAME" "c:\path to\server-command.exe" "arguments"
All works.
I know from this that its not running 'server-command.exe' the command that is causing the issue, its getting the connection to server using PSEXEC which seems to be failing unless the command prompt is being run in Elevated mode.
My question (as I haven't actually asked on yet!), is can PSEXEC work from the command prompt without having to be run administratively?
I'm trying to execute this as part of a much larger script, if I can't make it work without administrative privileges its not going to work.
Found the answer to this.......
https://serverfault.com/questions/280482/how-to-use-psexec-without-admin-privileges-on-target-machine
Basically, the user account executing the PSEXEC command needs local administrative rights on the destination host.
Adam
This might cause due to prevailing issue.
psexcec will start a service(windows) in end point .
check this
Run this as admin and will proceed without issues

PowerShell Start-Process with user in local Administrator does not start elevated PowerShell cmd

I have created a password file for the account with Administration privileges with the following script:
$passwd = Read-Host "Enter password" -AsSecureString
$encpwd = ConvertFrom-SecureString $passwd
$encpwd > "C:\Users\b_steya\Documents\password_b_steya.bin"
Then, in another powershell script I try to run an elevated PowerShell cmd
$encpwd = Get-Content "C:\Users\b_steya\Documents\password_b_steya.bin"
$passwd = ConvertTo-SecureString $encpwd
$cred = new-object System.Management.Automation.PSCredential 'main\b_steya',$passwd
Start-Process PowerShell -Cred $cred -ArgumentList '-noexit','-File','C:\Users\b_steya\Documents\TestAddIISAppPool.ps1'
When executing the second script, I get the following error message:
Import-Module : Process should have elevated status to access IIS
configuration data.
What am I doing wrong? The user "main\b_steya" is added to the local Administrators group of the machine, on wich the script is executed.
Best regards
Yannik
When your second script is executed is it done so from an administrator (runas administrator) powershell session? Even though the user is part of the local admin group you still often need to have the initial process elevated.

Resources