Jul 11 2017 09:30 AM
Hello
I have a windows PowerShell Script that I made to move a folder to anther folder on the same drive. (move-item 'E:\System State Folder' 'E:\Backup Folder') Action : Start a Program, Program/script: PowerShell, Add arguments: -ExecutionPolicy Bypass, Start in: C:\Users\Administrator\Desktop\Test.ps1
PowerShell opens but the folders do not move.
Jul 11 2017 10:14 AM
you forgot "-file" argument where you set path to your PS script. Please read more here https://blogs.technet.microsoft.com/heyscriptingguy/2012/08/11/weekend-scripter-use-the-windows-task...
Jul 11 2017 12:16 PM
And you might also need to run the script as administrator. In any case, add some logging/debugging capabilities in the script in order to troubleshoot it properly.
Jul 11 2017 12:24 PM
Jul 11 2017 12:35 PM
Paul, as I mentioned you are mising "-file" parameter, as from the script I see that you have mixed it with "-Start in" as this should be the directory where the script should run and not the path to your script as this parameter is optional
Jul 11 2017 12:53 PM
Sorry I didn't see your post earlier I will give it a try
Jul 12 2017 05:28 AM
It works great thanks for the quick response .
Sep 20 2017 03:41 PM
I wrote a blog post in March on how to use task scheduler to run PowerShell scripts with arguments: https://www.andersrodland.com/powershell-script-with-arguments-as-a-scheduled-task/