I have a PowerShell script (that works). In Windows Task Scheduler I created a new task to execute \"C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe\">
If you don't have any error messages and don't know what the problem is - why PowerShell scripts don't want to start from a Scheduled Task, do the following steps to get the answer:
You should be able to see all error notifications.
In case of one of my script it was:
Unable to find type [System.ServiceProcess.ServiceController]. Make sure that the assembly that contains this type is loaded.
And in this case I have to add an additional line at the beginning of the script to load the missing assembly:
Add-Type -AssemblyName "System.ServiceProcess"
And the next errors:
Exception calling "GetServices" with "1" argument(s): "Cannot open Service Control Manager on computer ''. This operation might require other privileges."
select : The property cannot be processed because the property "Database Name" already exists