Location: List Archives

List Archives

This forum is an archive of all posts to our mailing list over the past few years.  The forum is set read only therefore to contribute you will need to join our list community.  See more info about this here.

 

When subscribed to the list you should use your standard email client to send your posts to ActiveDir@mail.activedir.org.

List Archives

Subject: [ActiveDir] Script for checking rdp connection
Prev Next
You are not authorized to post a reply.

AuthorMessages
nidhinckUser is Offline

Posts:79

07/18/2010 10:09 AM  
Hi Guys,

I'am looking for a script to check the availability of the RDP connection to
Windows 2000/2003 Server.I'm rebooting about 900 servers for windows
patching. Some servers keep hanging in their reboots, and I would like to
have script to check the RDP really good. I prefer the use of VBScript or a
batch file.

--
Regards,

Nidhin.CK
Chennai
Phone No: +91 9884622467

SyedUser is Offline

Posts:22

07/18/2010 12:13 PM  
create a batch file which should telnet port 3389

telnet x.x.x.x 3389



On Sun, Jul 18, 2010 at 12:09 PM, nidhin ck <nidhinck@gmail.com> wrote:

> Hi Guys,
>
> I'am looking for a script to check the availability of the RDP connection
> to Windows 2000/2003 Server.I'm rebooting about 900 servers for windows
> patching. Some servers keep hanging in their reboots, and I would like to
> have script to check the RDP really good. I prefer the use of VBScript or a
> batch file.
>
> --
> Regards,
>
> Nidhin.CK
> Chennai
> Phone No: +91 9884622467
>
>
>

DaemonRootUser is Offline

Posts:131

07/18/2010 12:23 PM  
Of a "/for" doing a portqyr to 3389.



~D



From: activedir-owner@mail.activedir.org
[mailto:activedir-owner@mail.activedir.org] On Behalf Of Syed Khan
Sent: Sunday, July 18, 2010 5:12 AM
To: activedir@mail.activedir.org
Subject: Re: [ActiveDir] Script for checking rdp connection



create a batch file which should telnet port 3389



telnet x.x.x.x 3389





On Sun, Jul 18, 2010 at 12:09 PM, nidhin ck <nidhinck@gmail.com> wrote:

Hi Guys,



I'am looking for a script to check the availability of the RDP connection to
Windows 2000/2003 Server.I'm rebooting about 900 servers for windows
patching. Some servers keep hanging in their reboots, and I would like to
have script to check the RDP really good. I prefer the use of VBScript or a
batch file.


--

Regards,

Nidhin.CK
Chennai
Phone No: +91 9884622467






its.mikeUser is Offline

Posts:14

07/18/2010 1:53 PM  
netstat -a -b will tell you which port a local machine has open, and which
service has the port. On my win7 machine I get this:



5:30 C:\>netstat -a -b |findstr /n /i "24242 cryp"

20: TCP 0.0.0.0:3389 MyLocalWin7:0 LISTENING

21: CryptSvc



I tried this on an XP/SP3 machine and the output was a little different, so
some investigation is warranted (I don't have w2k/w2k3 handy at the moment).



Unfortunately this won't help you if you want to centrally query your server
universe.



From: activedir-owner@mail.activedir.org
[mailto:activedir-owner@mail.activedir.org] On Behalf Of nidhin ck
Sent: Sunday, July 18, 2010 2:09 am
To: activedir@mail.activedir.org
Subject: [ActiveDir] Script for checking rdp connection



Hi Guys,



I'am looking for a script to check the availability of the RDP connection to
Windows 2000/2003 Server.I'm rebooting about 900 servers for windows
patching. Some servers keep hanging in their reboots, and I would like to
have script to check the RDP really good. I prefer the use of VBScript or a
batch file.


--

Regards,

Nidhin.CK
Chennai
Phone No: +91 9884622467




andrewUser is Offline

Posts:77

07/18/2010 3:23 PM  
Hello Nidhin,

Two slightly different approaches, just FYI.

1. Use Remote Desktop Connection Manager
<http://www.microsoft.com/downloads/details.aspx?FamilyID=4603c621-6de7-4ccb-9f51-d53dc7e48047&displaylang=en>and
easily spot visually which servers are not responding on 3389.
2. Use Angry IP Scanner <http://www.angryip.org/w/Download>to scan on port
3389 your chosen address range.

Also, not wishing to state the obvious and/or patronise you but if you're
looking after that many servers and patches cause server hangs/crashes, do
you not test your patches in a separate non-production environment?

Kind regards,
Andrew

On 18 July 2010 21:52, mike Mitchell <its.mike@shaw.ca> wrote:

> netstat -a -b will tell you which port a *local* machine has open, and
> which service has the port. On my win7 machine I get this:
>
>
>
> 5:30 C:\>*netstat -a -b |findstr /n /i "24242 cryp"*
>
> 20: TCP 0.0.0.0:3389 MyLocalWin7:0 LISTENING
>
> 21: CryptSvc
>
>
>
> I tried this on an XP/SP3 machine and the output was a little different, so
> some investigation is warranted (I don't have w2k/w2k3 handy at the moment).
>
>
>
> Unfortunately this won't help you if you want to centrally query your
> server universe.
>
>
>
> *From:* activedir-owner@mail.activedir.org [mailto:
> activedir-owner@mail.activedir.org] *On Behalf Of *nidhin ck
> *Sent:* Sunday, July 18, 2010 2:09 am
>
> *To:* activedir@mail.activedir.org
> *Subject:* [ActiveDir] Script for checking rdp connection
>
>
>
> Hi Guys,
>
>
>
> I'am looking for a script to check the availability of the RDP connection
> to Windows 2000/2003 Server.I'm rebooting about 900 servers for windows
> patching. Some servers keep hanging in their reboots, and I would like to
> have script to check the RDP really good. I prefer the use of VBScript or a
> batch file.
>
>
> --
>
> Regards,
>
> Nidhin.CK
> Chennai
> Phone No: +91 9884622467
>
>
>

bsonposhUser is Offline

Posts:409

07/18/2010 4:06 PM  
For VBscript or batch use Portqry.exe

I have a powershell cmlet that does exactly this as well.

On 7/18/10, nidhin ck <nidhinck@gmail.com> wrote:
> Hi Guys,
>
> I'am looking for a script to check the availability of the RDP connection to
> Windows 2000/2003 Server.I'm rebooting about 900 servers for windows
> patching. Some servers keep hanging in their reboots, and I would like to
> have script to check the RDP really good. I prefer the use of VBScript or a
> batch file.
>
> --
> Regards,
>
> Nidhin.CK
> Chennai
> Phone No: +91 9884622467
>

--
Sent from my mobile device

EZiotsUser is Offline

Posts:0

07/20/2010 9:10 PM  
Can use NMAP



NMAP -iL c:\cpus.txt -sS -P0 -p 3389

IP the names/IP's/Networks in the txt file and let it rip.



Z





Edward E. Ziots

CISSP, Network +, Security +

Network Engineer

Lifespan Organization

Email:eziots@lifespan.org

Cell:401-639-3505



From: activedir-owner@mail.activedir.org
[mailto:activedir-owner@mail.activedir.org] On Behalf Of nidhin ck
Sent: Sunday, July 18, 2010 5:09 AM
To: activedir@mail.activedir.org
Subject: [ActiveDir] Script for checking rdp connection



Hi Guys,



I'am looking for a script to check the availability of the RDP
connection to Windows 2000/2003 Server.I'm rebooting about 900 servers
for windows patching. Some servers keep hanging in their reboots, and I
would like to have script to check the RDP really good. I prefer the use
of VBScript or a batch file.


--

Regards,

Nidhin.CK
Chennai
Phone No: +91 9884622467




jserbanUser is Offline

Posts:18

07/22/2010 11:22 AM  
Here are two PowerShell functions I found online when I was writing a script to audit DNS server settings on a couple of hundred servers. It will also work for your purpose of checking RDP. I found that it was better to ping first and then attempt to connect to the specified port as you could discern if the host was down versus a host that is pingable but not listening on a specific port. It was useful for DNS checking.

In your case where a server not answering on port 3389 is deemed a problem, you may be able to skip the ping.


Function Ping-Host ($phost)
# Function to ping a host
# Example use:
# $data = Ping-Host $strComputer
{
$Response = $null
$ping = new-object System.Net.NetworkInformation.Ping
$pingStatus = New-Object PSObject
Add-Member -InputObject $pingStatus noteproperty Status $null
Add-Member -InputObject $pingStatus noteproperty Address $null
Add-Member -InputObject $pingStatus noteproperty RoundtripTime $null
Add-Member -InputObject $pingStatus noteproperty Options $null
Add-Member -InputObject $pingStatus noteproperty Buffer $null
$Response = $ping.send($phost) #| Select-Object -Property Address
trap [Exception]
{
$pingStatus.status = "Failure"
continue
}
If ($Response.Status -eq "Success")
{
Return $Response
}
else
{
Return $pingStatus
}
}


# Function to test if a server is listening on a specified port
# Example use:
# $listening = Test-port -server <ServerName> -port <portnumber>
# $listening = Test-Port -srv <ServerName> -port 53
#
function Test-Port{
Param([string]$srv,$port=135,$timeout=3000,[switch]$verbose)
$ErrorActionPreference = "SilentlyContinue"
$tcpclient = new-Object system.Net.Sockets.TcpClient
$iar = $tcpclient.BeginConnect($srv,$port,$null,$null)
$wait = $iar.AsyncWaitHandle.WaitOne($timeout,$false)
if(!$wait)
{
$tcpclient.Close()
if($verbose){Write-Host "Connection Timeout"}
Return $false
}
else
{
$error.Clear()
$tcpclient.EndConnect($iar) | out-Null
Trap {continue}
if($errorΎ]){if($verbose){write-host $errorΎ]};$failed = $true}
$tcpclient.Close()
}
if($failed){return $false}else{return $true}
}

Enjoy




From: activedir-owner@mail.activedir.org [mailto:activedir-owner@mail.activedir.org] On Behalf Of Ziots, Edward
Sent: Tuesday, July 20, 2010 4:09 PM
To: activedir@mail.activedir.org
Subject: RE: [ActiveDir] Script for checking rdp connection

Can use NMAP

NMAP -iL c:\cpus.txt -sS -P0 -p 3389
IP the names/IP's/Networks in the txt file and let it rip.

Z


Edward E. Ziots
CISSP, Network +, Security +
Network Engineer
Lifespan Organization
Email:eziots@lifespan.org
Cell:401-639-3505

From: activedir-owner@mail.activedir.org [mailto:activedir-owner@mail.activedir.org] On Behalf Of nidhin ck
Sent: Sunday, July 18, 2010 5:09 AM
To: activedir@mail.activedir.org
Subject: [ActiveDir] Script for checking rdp connection

Hi Guys,

I'am looking for a script to check the availability of the RDP connection to Windows 2000/2003 Server.I'm rebooting about 900 servers for windows patching. Some servers keep hanging in their reboots, and I would like to have script to check the RDP really good. I prefer the use of VBScript or a batch file.

--
Regards,

Nidhin.CK
Chennai
Phone No: +91 9884622467




-----------------------------------------
This email transmission and any accompanying attachments may contain CSX privileged and confidential information intended only for the use of the intended addressee. Any dissemination, distribution, copying or action taken in reliance on the contents of this email by anyone other than the intended recipient is strictly prohibited. If you have received this email in error please immediately delete it and notify sender at the above CSX email address. Sender and CSX accept no liability for any damage caused directly or indirectly by receipt of this email.
You are not authorized to post a reply.
Forums >ActiveDir Mail List Archive >List Archives > [ActiveDir] Script for checking rdp connection



ActiveForums 3.7
Friends

Friends

VisualClickButoton
Members

Members

MembershipMembership:
Latest New UserLatest:cajoe64
New TodayNew Today:0
New YesterdayNew Yesterday:0
User CountOverall:5291

People OnlinePeople Online:
VisitorsVisitors:50
MembersMembers:0
TotalTotal:50

Online NowOnline Now:

Ads

Copyright 2012 ActiveDir.org
Terms Of Use