Register
: :
Login
Home
Forums
Blogs
Podcast
Directories
Scripts
Downloads
Community
User Group Support
Learning Resources
We have a new sponsor! Introducting
Pragma Systems
. See the home page for details.
Unanswered
Active Topics
Forums
Search
Members
Forums
>
Looking Ahead
>
Using PowerShell v2.0
Background job - run a ps1 script with a parameter
Last Post 09 Nov 2009 04:58 PM by
Shay
. 1 Replies.
Sort:
Oldest First
Most Recent First
Prev
Next
You are not authorized to post a reply.
Author
Messages
piotrp04
New Member
Posts:1
09 Nov 2009 04:44 PM
Hi,
how can I start a background job that will run a ps1 script with a parameter?
does the -filepath option of start-job expect only the script file path, or can I add parameters at the end as well?
My scenario is to get exchange mailbox details (and store in SQL) for each exchange server in parallel. So obviously want to run my ps1 script that does it, with a paramter which server to export mailboxes from.
Piotr
Shay
Veteran Member
Posts:1091
09 Nov 2009 04:58 PM
Use the -ArgumentList parameter to pass values:
Start-Job -Name TestJob -FilePath testScript.ps1 -ArgumentList foo,foo1 | Wait-Job | Receive-Job
Shay Levy
Windows PowerShell MVP
http://blogs.microsoft.co.il/blogs/ScriptFanatic
PowerShell Toolbar:
You are not authorized to post a reply.
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Using PowerShell
--General PowerShell
--Books, Tools, and Videos
--Exchange Server
--Active Directory
--System Center Family
--Non-Microsoft Products
--SharePoint
--SQL Server
--Working with .NET
--Peer Review
--Testing, Testing...
PowerShell Development
--Cmdlet Development
--PSDrive Provider Development
--Hosting the Shell
Looking Ahead
--Using PowerShell v2.0
--Developing for PowerShell v2.0
Forums
>
Looking Ahead
>
Using PowerShell v2.0
Active Forums 4.1
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008