I created a scheduled task to shuwdown/deallocate itself (it's a VM on Azure) with Powershell.
The PowerShell script is: Stop-AzureVM -Name "myvm" -ServiceName "myservice" -Force
If the PowerShell is ran by the scheduled task, the task just keeps on running and never shuts anything down.
What am I doing wrong? The user that executes the task is local admin on the VM itself. I tried to wait until the trigger to fire (after a specific time) and also tried to run it on demand (right click => run now), but none of them worked.
But if I right click on that same PowerShell script file and "Run with PowerShell", then it works like it should.