Is there any way to access and view the certificate store of the LocalService account?
I would like to add and delete certificates. (Using Windows Server 2008 R2)
I tried:
runas /user:"NT AUTHORITY\LocalService" mmc.exe
Also:
schtasks /create /sc once /st 09:36 /f /tr mmc.exe /tn taskname /ru LOCALSERVICE
schtasks /run /TN "taskname"
Without luck :(
Someone here suggested using PsExec for running commands with a service account.
Run psexec as administrator:
psexec -i -u "nt authority\local service" cmd.exe
In the new command window run:
certmgr.msc
I do not know if this will solve you problem, it is just a suggestion...
Related
Normally I use GPO to run scripts for all my users but I want to push out a powershell script and if certain conditions are not met, then it will create a schedule task for all users on that computer to run a local powershell script. (Needs to run with admin privs)
I am sure the solution is very simple but I just cannot get it to work.
I have tried all of the following including setting executionpolicy to unrestricted and moving where I am storing the script locally.
schtasks /create /f /ru "NT AUTHORITY\SYSTEM" /tn "MYTASK" /tr "powershell -file C:\ProgramData\script.ps1 -executionpolicy bypass" /sc onlogon
schtasks /create /f /tn "My Task Name" /ru Administrator /sc onlogon /tr "powershell.exe -noprofile -executionpolicy bypass -file C:\ProgramData\script.ps1"
I have also tried a .cmd file and .bat file with the following in them and calling them with the schtasks above:
powershell.exe -noprofile -executionpolicy bypass -file C:\ProgramData\script.ps1
schtasks /create /f /tn "My Task Name" /ru Administrator /sc onlogon /tr "C:\ProgramData\script.bat"
Any help is appreciated.
I want to run my script at boot up time in windows 7
I tried
Setup a scheduled task to run at startup - it doesn't run until someone logs in.
Local GP to run script at startup - it doesn't run until someone logs in.
Adding the scheduled task from a command prompt with admin - some time work some time not
schtasks /create /tn "start" /sc onstart /delay 0000:30 /rl highest /ru system /tr "powershell.exe -file <>
any other method to this ?
you can make an bat file in your startup folder.
startup.bat whit this content
Powershell -command "& {c:\Temp\Test.ps1}"
I use this command to run script in Vagrant via PowerShell
vagrant.exe powershell -c "SchTasks /Create /TN 'InstallTask' /SC ONCE /ST 23:59 /IT /RL HIGHEST /TR 'powershell -Command c:/vagrant/I_O.ps1' /F | Out-Host; SchTasks /Run /TN 'InstallTask' | Out-Host;"
But it works only if I start it manually from PowerShell ISE and as a separate command.
I want to use it inside this script block
# Run Vagrant
vagrant up
# Run PowerShell in Vagrant
vagrant.exe powershell -c "Set-Location C:\vagrant"
#Set policy to Unrestricted
vagrant.exe powershell -c "Set-ExecutionPolicy Unrestricted -Force"
# Install Chocolatey
vagrant.exe powershell -c "iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))"
# Turn off confirmation in Chocolatey
vagrant.exe powershell -c "chocolatey feature enable -n=allowGlobalConfirmation"
# Install .net 3.5
vagrant.exe powershell -c "choco install dotnet3.5 -force"
# Run O installation script
vagrant.exe powershell -c "SchTasks /Create /TN 'InstallTask' /SC ONCE /ST 23:59 /IT /RL HIGHEST /TR 'powershell -Command c:/vagrant/I_O.ps1' /F | Out-Host; SchTasks /Run /TN 'InstallTask' | Out-Host;"
I am trying to set a ftp upload to be scheduled whether or not the user is logged into their account. What i have so far is:
schtasks /create /sc once /tn "name" /tr "o:\upload.cmd" /st 15:15
I am running this at a elevated command prompt but it will only run when i am logged on. I have tried specifying /RU system, but this results in the command not being executed. Here is the code for that as well:
schtasks /create /sc once /tn "name" /tr "o:\upload.cmd" /ru system /st 15:15
Any guidance would be greatly appreciated!
If your o:\ drive is an mapped drive try to set full path to the file like this :
"\\servername\myfoldername\upload.cmd"
If the issue persist, config in Action panel like this:
Program: C:\Windows\System32\cmd.exe
Add argumetns (optional) : "/C schtasks /create /sc once /tn "name" /tr "o:\upload.cmd" /st 15:15"
It could be a limitation of the SYSTEM account. We have that issue with a service we provide, it can't access network paths.
Try /RU "Network Service" - whether this works however will be dependant on the contents of the file you're running and what it's trying to connect to.
EDIT: OHWAIT I assume the o: drive is a mapped network drive? If this is the case you will only be able to access the path of that script as the user while they are logged in. Otherwise you'll want to use Network Service as above (assuming it has access to the drive, else a domain account) and access the share directly, ie with \\server\share\script.cmd
I am trying to enable and disable a schedule task on windows server 2003 R2 from windows server 2008 R2 machine.
I am also using username and password. Error given Access is denied.
Following is the command
schtasks /change /disable /tn <taskname> /s <remoteserver 2003R2> /RU <username> /RP <password>
The issue was with user for running the schedule task. Added the user to the admin group. Issue resolved.