Forum Discussion

dmarquesgn's avatar
dmarquesgn
Iron Contributor
Sep 13, 2022
Solved

Create new-scheduletaskaction and execute powershell command within a variable

Hi, I've developing some scripts to automate some tasks, like managing Windows Updates by using the PSWindowsUpdate module. Now I'm at the stage where I got a variable with the update I need to do,...
  • Harm_Veenstra's avatar
    Sep 13, 2022

    You need to specify it as argument, so :
    $taskAction = New-ScheduledTaskAction -Execute 'C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe' -Argument $UpdateString'

Resources