Run as a task?

Nov 22, 2016 at 11:14 PM
I'm using a powershell script to trigger the refresh from a list of files I have in a text file. I can run it in the powershell window, in cmd, and from ISE, but not from a task.

powershell.exe -ExecutionPolicy Unrestricted -NonInteractive -NoProfile -file C:\Users\drs\DesktopRefresh\StageStores\Scripts\testingscripts\testingservice.ps1

Would this be expected to work? I'm not getting errors, it just doesn't actually refresh.

The powershell is pretty simple (no expert here):

$files = Import-Csv "C:\Users\drs\DesktopRefresh\StageStores\scripts\list.csv"
$refresh = "C:\Users\drs\DesktopRefresh\StageStores\refresh\"
$fresh = "C:\Users\drs\DesktopRefresh\StageStores\Fresh\"

foreach ($file in $files)
{
$workstationpath = $file.workstation + $file.file_name
$saveto = $fresh + $file.file_name
& "C:\Program Files\Excel Refresher\RefreshExcel.exe" $workstationpath /S:$saveto
Remove-Item $workstationpath
}