I dont want the blue window to pop up when my script gets run. It should be done in the background as it is for a screen at a public place :)
I tried with -Argument '-NoProfile -WindowStyle Hidden
My full code is:
function Create-Schedule{
$action = New-ScheduledTaskAction -Execute 'Powershell.exe' -Argument '-NoProfile -WindowStyle Hidden -command "& {C:\PowerPointScript\myscript.ps1}"'
$trigger = New-ScheduledTaskTrigger -Once -At (get-date) -RepetitionInterval (New-TimeSpan -Minutes 1)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "Powerpoint" -Description "Run Powerpoint download script every 5th min"
}