Monthly archives: February 2014

Timothy

It's Not That Complicated: PowerShell and Task Scheduler

There is no end to complicated methods on the internet regarding the proper way to schedule a PowerShell task.  You see all manner of command line switches and escape sequences.  It's not that complicated!  Your task is powershell.exe and your argument is the path to the script.  If you need to quote the path because it contains spaces, use a combination of single and double quotes to parameterize the argument and then quote the path within the parameter.  When you do this, you also need to remember to precede the inner quote with an ampersand so PowerShell treats it as a script to execute and not just an output string.  It sounds more complicated than it actually is.

Examples:

powershell.exe c:\tasks\mycoolscript.ps1

powershell.exe "& 'c:\my path\with spaces\mycoolscript.ps1'"

Blog

Search Posts

Recent Comments

  1. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Edward: It also crashes with the 4387 error if you have the SQL Management Studio 17 tools installed. Installing...

  2. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Ram: Hi - I followed richsmif instruction and was able to successfully install DPM 2016 on SQL 2016. Completed...

  3. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Neighborgeek: Thanks for the post, this is exactly the issue I am running into. I'm disappointed to see that you didn...

  4. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    richsmif: I have DPM 16 working with SQL 16. Install SQL 16 first, don't touch, install DPM 16 , upgrade...

  5. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: That should have been *ID 810*, not 820

  6. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: For anyone else coming across this in the future and have an ID 820 error: For some strange reason...

  7. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Timothy: Sorry, I don't have any other insight. I'm sure you ran into all the same articles I did about the error...

  8. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: FYI, after posting the issue on technet + windows-noob.com with no replies I decided to do a fresh Windows...

  9. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    ptbNPA: Hi and thanks for your post. I originally installed SQL 2016 with SP1 on a Windows server 2016 and got...

  10. Re: DPM 2016 + SQL 2016 and "An unexpected error occurred during the installation" ID: 4387
    Timothy: Update Rollup 2.

Archive

Tag Cloud