Scripting Question

Getting error code: -1 when trying to run a script

12/13/2016 1204 views
We are trying to run a script to change a scheduled task but are running into issues.  Below are the Powershell and bat files, along with the log file.  
It is an offline Kscript, allowed to run without a logged-in user, 

Any thoughts?

If ((Get-ScheduledTask -TaskName 'ScheduledDefrag').State -eq 'Ready') 
    Disable-ScheduledTask -TaskName 'ScheduledDefrag' -TaskPath '\Microsoft\Windows\Defrag'
Get-ScheduledTask -TaskName 'ScheduledDefrag'
Bat: "C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\97\DisableDefrag2012.ps1"
also tried: powershell.exe powershell.exe -ExecutionPolicy Bypass  -Command "C:\ProgramData\Dell\KACE\kbots_cache\packages\kbots\97\DisableDefrag2012.ps1"
1 Comment   [ + ] Show comment


  • We got it to work by starting over. Not sure what was wrong but it'd be nice to know why we got an error code: -1 in the Output log.

Be the first to answer this question

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ