RDP-Testing: Unterschied zwischen den Versionen

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
(Die Seite wurde neu angelegt: „<source lang="powershell"> $VMs = @( "server1.domain.ch" ) $Port = 3389 $Logfile = "C:\Temp\RDPTrace.txt" $enddate = (Get-Date).AddDays(1) while ((get-date)…“)
 
K
 
Zeile 12: Zeile 12:
 
     foreach ($VM in $VMs){
 
     foreach ($VM in $VMs){
 
     $Output = Test-NetConnection -ComputerName $VM -Port $port -WarningAction SilentlyContinue
 
     $Output = Test-NetConnection -ComputerName $VM -Port $port -WarningAction SilentlyContinue
 
    # Abklärunge Time-out
 
    Write-Host "1x Durchlauf"
 
    Write-Host "$logtext"
 
  
 
     if (!$Output.TcpTestSucceeded -eq $true){
 
     if (!$Output.TcpTestSucceeded -eq $true){

Aktuelle Version vom 22. September 2017, 16:24 Uhr

$VMs = @(
"server1.domain.ch"
)
 
$Port = 3389
$Logfile = "C:\Temp\RDPTrace.txt"
$enddate = (Get-Date).AddDays(1)
 
while ((get-date) -le $enddate){
 
    foreach ($VM in $VMs){
    $Output = Test-NetConnection -ComputerName $VM -Port $port -WarningAction SilentlyContinue
 
    if (!$Output.TcpTestSucceeded -eq $true){
       $timestamp = get-date
       $logtext = "$timestamp : Test auf $VM mit Port TCP $port not Successful"
       Add-Content -Path $Logfile -Value $logtext
    }
      Start-Sleep -Seconds 1
    }
}