but i could be wrong , i think that answer is no, because the listining ports is open by the running process at runtime and no process is registry each port in registry, all i was know thats OS have TCP table and UDP table and all of these tables stored in memory not in registry, and you can get it using API call, but from VBscript i dont know where i can get it from, but i think may be there is way to do that from Winmgmts: or RPC i dont know exactly, i am not experienced with them, and i think may be you could get what ports OS services provide from registry as Microsoft-Ds port = "445" from registry Key for example
I have copied "MSWINSCK.o cx" to C:\WINNT|System 32 and also registered it, checked everything is fine, looks like the code needs to be modified, can you please take a loook at your code once again and send me again.
thnx a million for ur patience and support, appreciate you... :)
slightly modifed your script, removed While and added some other logic...I got it this time........... . :)
GR8 THANKS AHMED.......rea lly appreciate your srupport
Call CheckPort(srv_n ame,77)
Dim SockObject
Function CheckPort(Byval Server,Byval Port)
set SockObject=Crea teObject("MSWin sock.Winsock.1" )
SockObject.Prot ocol=0 ' TCP
SockObject.Clos e
SockObject.Conn ect Server,port
Wscript.Sleep 50
if(SockObject.S tate=6) then ' if sockect is attempting to connect i.e
WScript.echo "Invalid Port"
elseif(SockObje ct.State=7) then ' if socket connected
WScript.echo "Port Open"
elseif(SockObje ct.State=9)then ' If Error
WScript.echo "error"
elseif(SockObje ct.State=0)then 'Closed
WScript.echo "connection refused"
end if
call SockObject.Clos e
set SockObject=noth ing
End Function
Comment