<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Split-Job 0.93</title>
	<atom:link href="http://www.jansveld.net/powershell/2008/12/split-job-093/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.jansveld.net/powershell/2008/12/split-job-093/</link>
	<description>Observations and examples of PowerShell in the real world</description>
	<lastBuildDate>Thu, 08 Dec 2011 14:31:09 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Part IV : Move Computers to OU based on IP Subnets</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-3826</link>
		<dc:creator>Part IV : Move Computers to OU based on IP Subnets</dc:creator>
		<pubDate>Thu, 08 Dec 2011 14:31:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-3826</guid>
		<description>[...] Split-Job : Used to speed up the script execution. So the script will execute 10 times faster. Credit goes to Arnoud Jansveld [...]</description>
		<content:encoded><![CDATA[<p>[...] Split-Job : Used to speed up the script execution. So the script will execute 10 times faster. Credit goes to Arnoud Jansveld [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bridging the GAP between AD, DNS, Sites, IP Subnets and SCCM using Powershell &#124; myITforum.com</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-3266</link>
		<dc:creator>Bridging the GAP between AD, DNS, Sites, IP Subnets and SCCM using Powershell &#124; myITforum.com</dc:creator>
		<pubDate>Mon, 24 Oct 2011 20:15:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-3266</guid>
		<description>[...] Split-Job : Used to speed up the script execution. So the script will execute 10 times faster. Credit goes to Arnoud Jansveld [...]</description>
		<content:encoded><![CDATA[<p>[...] Split-Job : Used to speed up the script execution. So the script will execute 10 times faster. Credit goes to Arnoud Jansveld [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Kmiec</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-2632</link>
		<dc:creator>John Kmiec</dc:creator>
		<pubDate>Thu, 14 Jul 2011 15:24:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-2632</guid>
		<description>Stephen or Arnoud,

How would i deal with variables within Functions that I would like to Split-Job?  

Here is a snip of my script:

Import-Module -Name .\_Modules\Split-Job.psm1

Function GetSystemState
{ # Begin Function GetSystemState()
	# Pings each of the system names found to check if online
    # Writes findings to a files.
		$intCounter++
		Write-Host &quot;[&quot;$intCounter&quot;/&quot;$intCounterMax]&quot; Checking Computer: &quot; $_  -BackgroundColor Cyan -ForegroundColor White
        If (Test-Connection -ComputerName $_ -Quiet -Count 1)
        { # If Computer is alive
            # Adds Computer Name to Alive File
            $strAliveList += $_
        } # End of True Test-Connection
        Else # Test-Connection
        { # Begin of Else for Test-Connection
            $strDeadList += $_
        } # End of Else for Test-Connection
} # End Function GetSystemState()

# Function Variables
$GLOBAL:strAliveList = @()
$GLOBAL:strDeadList = @()

# Get Computer Status
# Determines if Computer is On-Line
Write-Host &quot;Getting Computer Status....................................................&quot; -BackgroundColor Black -ForegroundColor White
$GLOBAL:intCounter = 0
$GLOBAL:intCounterMax = $computerList.Length
$computerList &#124; Split-Job { % {GetSystemState}} -Function GetSystemState


It does not update my Alive or Dead Variables nor does it increment my counter.  I also have split-job running another part of my script where it searches the alive computers and put information inside variables as well with the same result of not passing back to main script.

Any and all help would be greatly appreciated!!!  I fairly new to powerschell and all self-taugh with google search help.  That&#039;s were I came accross your script.  I am running v1.2</description>
		<content:encoded><![CDATA[<p>Stephen or Arnoud,</p>
<p>How would i deal with variables within Functions that I would like to Split-Job?  </p>
<p>Here is a snip of my script:</p>
<p>Import-Module -Name .\_Modules\Split-Job.psm1</p>
<p>Function GetSystemState<br />
{ # Begin Function GetSystemState()<br />
	# Pings each of the system names found to check if online<br />
    # Writes findings to a files.<br />
		$intCounter++<br />
		Write-Host &#034;["$intCounter"/"$intCounterMax]&#034; Checking Computer: &#034; $_  -BackgroundColor Cyan -ForegroundColor White<br />
        If (Test-Connection -ComputerName $_ -Quiet -Count 1)<br />
        { # If Computer is alive<br />
            # Adds Computer Name to Alive File<br />
            $strAliveList += $_<br />
        } # End of True Test-Connection<br />
        Else # Test-Connection<br />
        { # Begin of Else for Test-Connection<br />
            $strDeadList += $_<br />
        } # End of Else for Test-Connection<br />
} # End Function GetSystemState()</p>
<p># Function Variables<br />
$GLOBAL:strAliveList = @()<br />
$GLOBAL:strDeadList = @()</p>
<p># Get Computer Status<br />
# Determines if Computer is On-Line<br />
Write-Host &#034;Getting Computer Status&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;&#8230;.&#034; -BackgroundColor Black -ForegroundColor White<br />
$GLOBAL:intCounter = 0<br />
$GLOBAL:intCounterMax = $computerList.Length<br />
$computerList | Split-Job { % {GetSystemState}} -Function GetSystemState</p>
<p>It does not update my Alive or Dead Variables nor does it increment my counter.  I also have split-job running another part of my script where it searches the alive computers and put information inside variables as well with the same result of not passing back to main script.</p>
<p>Any and all help would be greatly appreciated!!!  I fairly new to powerschell and all self-taugh with google search help.  That&#039;s were I came accross your script.  I am running v1.2</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Mills</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-2348</link>
		<dc:creator>Stephen Mills</dc:creator>
		<pubDate>Fri, 27 May 2011 21:18:52 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-2348</guid>
		<description>@Charles

Here&#039;s a quick way to get what you seem to be looking for.

&#039;computer1&#039;, &#039;computer2&#039;, &#039;computer3&#039; &#124; Split-Job { % { GWMI Win32_OperatingSystem -ComputerName $_ -Property CSName, LocalDateTime, LastBootUpTime }} &#124; Select @{n=&#039;ComputerName&#039;;e={ $_.CSName}}, @{n=&#039;UpTime&#039;;e={ [datetime]$_.LocalDateTime - [datetime]$_.LastBootUpTime}}</description>
		<content:encoded><![CDATA[<p>@Charles</p>
<p>Here&#039;s a quick way to get what you seem to be looking for.</p>
<p>&#039;computer1&#039;, &#039;computer2&#039;, &#039;computer3&#039; | Split-Job { % { GWMI Win32_OperatingSystem -ComputerName $_ -Property CSName, LocalDateTime, LastBootUpTime }} | Select @{n=&#039;ComputerName&#039;;e={ $_.CSName}}, @{n=&#039;UpTime&#039;;e={ [datetime]$_.LocalDateTime &#8211; [datetime]$_.LastBootUpTime}}</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Mills</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-2097</link>
		<dc:creator>Stephen Mills</dc:creator>
		<pubDate>Thu, 21 Apr 2011 21:48:22 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-2097</guid>
		<description>Thanks for uploading it.  I&#039;ve uploaded a version 1.2 that actually only works with PowerShell V2, but also works with powershell_ise.  The 1.0 version would leave the pipelines running if you exited the script early ( by hitting Escape in powershell_ise or Ctrl-C in powershell.exe) .  It also adds various other improvements like InitializeScript, MaxDuration, time remaining, and a few other minor things.

http://poshcode.org/2621</description>
		<content:encoded><![CDATA[<p>Thanks for uploading it.  I&#039;ve uploaded a version 1.2 that actually only works with PowerShell V2, but also works with powershell_ise.  The 1.0 version would leave the pipelines running if you exited the script early ( by hitting Escape in powershell_ise or Ctrl-C in powershell.exe) .  It also adds various other improvements like InitializeScript, MaxDuration, time remaining, and a few other minor things.</p>
<p><a href="http://poshcode.org/2621" rel="nofollow">http://poshcode.org/2621</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Arnoud Jansveld</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-2088</link>
		<dc:creator>Arnoud Jansveld</dc:creator>
		<pubDate>Wed, 20 Apr 2011 17:11:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-2088</guid>
		<description>Great idea! I had a few minor updates in the pipeline as well and posted it here: http://poshcode.org/2619.</description>
		<content:encoded><![CDATA[<p>Great idea! I had a few minor updates in the pipeline as well and posted it here: <a href="http://poshcode.org/2619" rel="nofollow">http://poshcode.org/2619</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen Mills</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-2083</link>
		<dc:creator>Stephen Mills</dc:creator>
		<pubDate>Wed, 20 Apr 2011 04:13:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-2083</guid>
		<description>Would you mind if I would post this ( well an updated version of it) to poshcode.org?  I was just at TEC 2011 and the PowerShell Deep Dive some of the people are interested in it.  I could always send them a copy, but it would be nice to have it somewhere, where everyone could get it easily and potentially post updates to it.

Thanks,

Stephen</description>
		<content:encoded><![CDATA[<p>Would you mind if I would post this ( well an updated version of it) to poshcode.org?  I was just at TEC 2011 and the PowerShell Deep Dive some of the people are interested in it.  I could always send them a copy, but it would be nice to have it somewhere, where everyone could get it easily and potentially post updates to it.</p>
<p>Thanks,</p>
<p>Stephen</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Charles Welton</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-1442</link>
		<dc:creator>Charles Welton</dc:creator>
		<pubDate>Sat, 29 Jan 2011 23:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-1442</guid>
		<description>Hello...

I just found your site by chance looking for help trying to multi-thread a powershell script.  I am still rather unfamiliary with powershell syntax and need a quick fix.  Here is my code below:

##
#  Start of script
##

# Helper Function - convert WMI date to TimeDate object
function WMIDateStringToDate($Bootup) {
	[System.Management.ManagementDateTimeconverter]::ToDateTime($Bootup)
}

# Main script
$Computer = $args[0] # adjust as needed
$computers = Get-WMIObject -class Win32_OperatingSystem -Impersonation 3 -computer $computer -authentication 6
#$computers = Get-WMIObject -class Win32_OperatingSystem -computer $computer

foreach ($system in $computers) {
	$Bootup = $system.LastBootUpTime
	$LastBootUpTime = WMIDateStringToDate($Bootup)
	$now = Get-Date
	$Uptime = $now - $lastBootUpTime
	$d = $Uptime.Days
	$h = $Uptime.Hours
	$m = $uptime.Minutes
	$ms= $uptime.Milliseconds

	&quot;System Up for: {0} days, {1} hours, {2}.{3} minutes&quot; -f $d,$h,$m,$ms
} 
# End script

Any ideas how I could use &quot;start-job&quot; for mutli-threading?  Let&#039;s say I have 20 servers I need to run this script against, and I want them all running in parallel.

ANY help would be greatly appreciated!!!! :)</description>
		<content:encoded><![CDATA[<p>Hello&#8230;</p>
<p>I just found your site by chance looking for help trying to multi-thread a powershell script.  I am still rather unfamiliary with powershell syntax and need a quick fix.  Here is my code below:</p>
<p>##<br />
#  Start of script<br />
##</p>
<p># Helper Function &#8211; convert WMI date to TimeDate object<br />
function WMIDateStringToDate($Bootup) {<br />
	[System.Management.ManagementDateTimeconverter]::ToDateTime($Bootup)<br />
}</p>
<p># Main script<br />
$Computer = $args[0] # adjust as needed<br />
$computers = Get-WMIObject -class Win32_OperatingSystem -Impersonation 3 -computer $computer -authentication 6<br />
#$computers = Get-WMIObject -class Win32_OperatingSystem -computer $computer</p>
<p>foreach ($system in $computers) {<br />
	$Bootup = $system.LastBootUpTime<br />
	$LastBootUpTime = WMIDateStringToDate($Bootup)<br />
	$now = Get-Date<br />
	$Uptime = $now &#8211; $lastBootUpTime<br />
	$d = $Uptime.Days<br />
	$h = $Uptime.Hours<br />
	$m = $uptime.Minutes<br />
	$ms= $uptime.Milliseconds</p>
<p>	&#034;System Up for: {0} days, {1} hours, {2}.{3} minutes&#034; -f $d,$h,$m,$ms<br />
}<br />
# End script</p>
<p>Any ideas how I could use &#034;start-job&#034; for mutli-threading?  Let&#039;s say I have 20 servers I need to run this script against, and I want them all running in parallel.</p>
<p>ANY help would be greatly appreciated!!!! <img src='http://www.jansveld.net/powershell/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raymond Siring</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-1364</link>
		<dc:creator>Raymond Siring</dc:creator>
		<pubDate>Mon, 17 Jan 2011 14:10:02 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-1364</guid>
		<description>Hi I&#039;m trying to make a powershell script using your split-job to mail-bomb my company servers. This is purely for testing purposes, but I&#039;m having some issues working out som snags. I&#039;m no powershell expert by any means.

I&#039;m using the Net.Mail.SmtpClient for this script and my pipeline looks something like this:
Get-Content c:\mailaddresses.txt &#124; Split-Job {$smtp.Send($_, $emailTo, $subject, $body) }
I&#039;ve set all the variables and also have $smtp = new-object Net.Mail.SmtpClient($smtpServer) in my script. Any help towards why I get this error?

Expressions are only allowed as the first element of a pipeline.
At line:7 char:51
+         $smtp.Send($_, $emailTo, $subject, $body)  &lt;&lt;&lt;&lt; 
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
    + FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline

The first 155 lines of this script is the source for the split-job.ps1.</description>
		<content:encoded><![CDATA[<p>Hi I&#039;m trying to make a powershell script using your split-job to mail-bomb my company servers. This is purely for testing purposes, but I&#039;m having some issues working out som snags. I&#039;m no powershell expert by any means.</p>
<p>I&#039;m using the Net.Mail.SmtpClient for this script and my pipeline looks something like this:<br />
Get-Content c:\mailaddresses.txt | Split-Job {$smtp.Send($_, $emailTo, $subject, $body) }<br />
I&#039;ve set all the variables and also have $smtp = new-object Net.Mail.SmtpClient($smtpServer) in my script. Any help towards why I get this error?</p>
<p>Expressions are only allowed as the first element of a pipeline.<br />
At line:7 char:51<br />
+         $smtp.Send($_, $emailTo, $subject, $body)  &lt;&lt;&lt;&lt;<br />
    + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException<br />
    + FullyQualifiedErrorId : ExpressionsMustBeFirstInPipeline</p>
<p>The first 155 lines of this script is the source for the split-job.ps1.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jay</title>
		<link>http://www.jansveld.net/powershell/2008/12/split-job-093/comment-page-1/#comment-665</link>
		<dc:creator>Jay</dc:creator>
		<pubDate>Fri, 23 Jul 2010 20:14:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.jansveld.net/powershell/?p=8#comment-665</guid>
		<description>Your script rocks! We had a dual quad core server that&#039;s idle most of the time and now I can spike out all cores with this script and jobs complete much much faster.
I&#039;ve had to add two snapins with
-snapin quest.activeroles.admanagement,Microsoft.Exchange.Management.PowerShell.Admin
and things work perfectly.
I&#039;m even incorporating it into some other scripts I have that use a foreach command with extremely large script blocks within and it still works fine.</description>
		<content:encoded><![CDATA[<p>Your script rocks! We had a dual quad core server that&#039;s idle most of the time and now I can spike out all cores with this script and jobs complete much much faster.<br />
I&#039;ve had to add two snapins with<br />
-snapin quest.activeroles.admanagement,Microsoft.Exchange.Management.PowerShell.Admin<br />
and things work perfectly.<br />
I&#039;m even incorporating it into some other scripts I have that use a foreach command with extremely large script blocks within and it still works fine.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

