Skip to content

Instantly share code, notes, and snippets.

@gravejester
Last active August 29, 2015 14:07
Show Gist options
  • Select an option

  • Save gravejester/336fdc4b4a80b517d3aa to your computer and use it in GitHub Desktop.

Select an option

Save gravejester/336fdc4b4a80b517d3aa to your computer and use it in GitHub Desktop.
# pingMonitor
# http://learn-powershell.net/2013/04/19/sharing-variables-and-live-objects-between-powershell-runspaces/
# http://www.zerrouki.com/powershell-menus-host-ui-promptforchoice-defined-or-dynamic/
$ComputerName = 'HCB-MSYS02'
$code = {
param (
[System.String] $ComputerName,
[System.Int32] $TimeOut = 5000,
[System.Byte[]] $Buffer = [System.Text.Encoding]::ASCII.GetBytes('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa'),
[System.Int32] $Ttl = 128,
[System.Boolean] $DontFragment = $false
)
$pingOptions = New-Object -TypeName 'System.Net.NetworkInformation.PingOptions' -ArgumentList @($Ttl,$DontFragment)
$ping = New-Object -TypeName 'System.Net.NetworkInformation.Ping'
while ($true) {
$pingReply = $ping.Send($ComputerName,$TimeOut,$Buffer,$pingOptions)
}
}
foreach ($computer in $ComputerName) {
}
#$minRunspaces = 1
#$maxRunspaces = 4
#$runspacePool = [System.Management.Automation.Runspaces.RunspaceFactory]::CreateRunspacePool($minRunspaces, $maxRunspaces)
#$runspacePool.Open()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment