header
header Register : : Login header
header
divider
menuleft
menuright
submenu
left

We have a new sponsor!  Introducting Pragma Systems.  See the home page for details.

Background job - run a ps1 script with a parameter
Last Post 09 Nov 2009 04:58 PM by Shay. 1 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
piotrp04User is Offline
New Member
New Member
Posts:1
Avatar

--
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
ShayUser is Offline
Veteran Member
Veteran Member
Posts:1091
Avatar

--
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.

Active Forums 4.1
right
   
footer Sponsored by Quest Software • SAPIEN Technologies • Compellent • Microsoft Windows Server 2008 footer
footer