0
votes

I am using windows 8. I have the following script file (that spits our all services to a CSV file). When I run this as follows from powershell editor, it works fine.

 C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe C:\Powershell\SchedulingaScript.ps1

When I schedule this script from windows task scheduler it won't kick off. I have "Unrestricted" execution policy set on that session. Following is the code in the script file and 2 images are the setting on the task scheduler.

  #Trying out scheduling powershell scripts

  Get-Service | Export-CSV "C:\ExportingServicestoaCSVFile.CSV"

Actions

Trigger

2

2 Answers

0
votes

You have to use the -file Parameter. Simply enter powershell -? and you will see all possible options to launch powershell.

Hope this helps -tom

0
votes

In the Edit Action dialog Program box simply put PowerShell. In Arguments put -file "C:\sciptlocation\scriptname.ps1"