About Me

My photo
HANUMANGARH, RAJASTHAN, India

Thursday, 4 August 2022

Check RDP port in remote host

 $ser = Get-Content C:\Users\su-skumar\Desktop\servers.txt

 

ForEach ($one in $ser){

    Test-NetConnection -ComputerName $one -CommonTCPPort RDP | 

    Select-Object -Property ComputerName, RemotePort, PingSucceeded, TcpTestSucceeded | 

    Out-File -FilePath 'C:\Temp\TNCResults.txt' -Append

}  

Get-Content -Path 'C:\Temp\TNCResults.txt'

No comments:

Post a Comment

Extract Disk Info from Remote host

 # Define the remote hostname or IP address $remoteHost = Get-Content "C:\temp\RemoteServer.txt" # Define the output CSV file path...