Running PowerShell Scripts as a Service

You should call powershell.exe with the options -noprofile -command like this to run a PowerShell script externally:

Powershell.exe -noprofile -command c:\...\script.ps1

Schedule it as a task if you want to run a script as a service. You can simply add a scheduled task inside your control panel, and specify powershell.exe as the application to run. Place the rest of your line in the arguments field. With the options of your scheduled task, you can then decide whether you want to hide the PowerShell window, the account the script runs under, and the privileges it should receive.

Twitter This Tip! ReTweet this Tip!


Posted Jan 26 2010, 08:00 AM by ps1

Comments

Twitter Trackbacks for Running PowerShell Scripts as a Service - Power Tips - PowerShell.com [powershell.com] on Topsy.com wrote Twitter Trackbacks for Running PowerShell Scripts as a Service - Power Tips - PowerShell.com [powershell.com] on Topsy.com
on 01-26-2010 9:03 PM

Pingback from  Twitter Trackbacks for                 Running PowerShell Scripts as a Service - Power Tips - PowerShell.com         [powershell.com]        on Topsy.com

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.