Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

question about errorcontinue

$
0
0
Hello,
I am preparing a script that it should help identify TCP and ICA listenner which they are down.
For that I am using Powershell Terminal Services module (http://archive.msdn.microsoft.com/PSTerminalServices)
As a first step before developing further, I wanted to query the TCP and ICA listenner from all my servers.
Whenever I am facing any kind of issue with the Get-TsSession function, the script simply stops.

Is there any way I can for the script to ignore any kind of error and continue to the next server ?
 
erroractionpreference =Continue
import-module psterminalservices
$servers=get-content .\servers.txt | foreach { $_.Trim() }
$servers
foreach ($serverin$servers) {
write-host$server-ForegroundColor green
Get-TSSession-erroractionContinue-computername$server-verbose
}
Thanks in advance,

Viewing all articles
Browse latest Browse all 8583

Latest Images

Trending Articles



Latest Images