I'm trying to create a bat file to modify a scheduled task setting, for this I have tried these two methods (A-B):
.BAT
powershell -executionpolicy Unrestricted -File C:\Temp\config\tasks.ps1
A) tasks.ps1
$settingsSet = New-ScheduledTaskSettingsSet
$settingsSet.ExecutionTimeLimit = 'PT0S'
Set-ScheduledTask -TaskName TaskStart -Settings $settingsSet
B) tasks.ps1
$task = Get-ScheduledTask "TaskStart"
$task.Settings.ExecutionTimeLimit = "PT0S"
Set-ScheduledTask $task
both work in w10, but in w7 I have the same error:
The term '***' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again."
How can you make this in w7? I would like to know how to modify the ExecutionTimeLimit.
Thanks in Advance