0

I am trying to run a script with the Task Scheduler. It works just fine when the user is logged in, but when I try to run it when the user is not logged in, the command Get-SCVirtualMachine returns null.

The script does run, but just that command doesnt return any value when I am running it without the service account being logged in.

Of course I have the "Run wether user is logged on or not" flag set to true. And as I said, the script gets executed, just that SCVMM cmdlet isn't working.

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
FlexXx
  • 81
  • 9
  • Either have the scheduled task run as the service account, or get the required permissions for access to SCVMM assigned to your own account. Besides, this is a question for [ServerFault](https://serverfault.com/). – Ansgar Wiechers Jun 08 '17 at 09:30
  • the scheduled task is run as a service account as i said. And he has the Permissions to use SCVMM.. it works if i logon to the server once and then start the task job. But it doesnt if i wasnt logged on since the last restart. – FlexXx Jun 08 '17 at 10:33

1 Answers1

0

The Solution was to add the service account as a local administrator. Somehow i totally forgot that. Therefore it could'nt load the needed PS Modules.

FlexXx
  • 81
  • 9