Register
: :
Login
Home
News
Forums
Scripts
User Groups
Resources
About
Forums
Search
Members
Unanswered
Active Topics
Forums
>
Looking Ahead
>
Using PowerShell v2.0
Background job - run a ps1 script with a parameter
Last Post 09 Nov 2009 08:58 AM by
Shay Levy
. 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 08:44 AM
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 Levy
PowerShell MVP, Admin
Veteran Member
Posts:1362
09 Nov 2009 08:58 AM
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://PowerShay.com
PowerShell Community Toolbar
Twitter:
@ShayLevy
You are not authorized to post a reply.
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
PowerShellCommunity.org
--Community Announcements and Assistance
--Completely Unrelated
--User Groups
--Community Business
----Suggestion Box
Forums
>
Looking Ahead
>
Using PowerShell v2.0
Active Forums 4.3
Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 R2