Sign in
|
Join PowerShell.com!
|
Help
Home
PowerTips
Ask the Experts
Forums
Webcasts
Blogs
eBook
Script Library
Twitter Grid
Modules
QuickClick
Scripts
Snippets
Videos
Library
»
Script Library
»
Networking
»
Test-Connection to Multiple Hosts
Test-Connection to Multiple Hosts
Share
|
Browse Library
Module Library
QuickClick Library
Script Library
Active Directory
BizTalk
Citrix
Clustering
Desktop
Exchange Server 2003
Exchange Server 2007
File System
Group Policy
Internet Information Server (IIS)
Local Accounts
Logs
Microsoft Office
Microsoft Team Foundation Server
MySQL
Networking
Registry
Remote Desktop Services
Remoting
Security
SharePoint
SQL Server
System Center Virtual Machine Manager
System Center Configuration Manager
System Center Operations Manager
Tutorial
Terminal Server
Using .Net
Virtual Server
VMware
Windows 7
Windows HPC
Windows Server 2000
Windows Server 2003
Windows Server 2008
Windows XP
WMI
Misc
Snippet Library
Video Library
Members Only
Tags
Background Job
Check
email
event viewer
Host
Hostname
iisreset
IP
ip address
ipaddress
IPv4
IPv6
mail
Online
Parse
Ping
powershell v2
range
Resolve
SMTP
System.Net.IPAddress
System.URI
test-connection
URL
validate
View more
Previous
|
Next
|
View all files
|
View Slideshow
Download
posted by
Talsu
06-27-2010
Downloads: 374
File size: 462 B
Views: 1,981
Embed
Test-Connection to Multiple Hosts
Function
Test-MultipleConnections
{
param
(
[
string
]
$Gateway
,
[
int
]
$StartPosition
=
1,
[
int
]
$EndPosition
=
255
)
if
(
$Gateway
-match
"(\d{1,3}\.){2}\d{1,3}"
)
{
$StartPosition
..
$EndPosition
|
Foreach-Object
{
$ResultHash
=
@{}
$ResultHash
.
Address
=
"{0}.{1}"
-f
$Matches
[0],
$_
$ResultHash
.
IsSuccess
=
Test-Connection
$ResultHash
.
Address
-count
1
-quiet
New-Object
PSObject
-Property
$ResultHash
}
}
}
Test-Connection to many hosts.
Copyright 2011 PowerShell.com. All rights reserved.