Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for whoiscom.vbs

(view source code of whoiscom.vbs as plain text)

  1. Option Explicit
  2.  
  3. Dim objFSO, objWhois, strWSC
  4.  
  5. On Error Resume Next
  6. ' First let's see if the component is registered
  7. Set objWhois = CreateObject( "robvanderwoude.Whois.2" )
  8. If Err Then
  9. 	' If not, check if it exists in the current directory
  10. 	' and use an alternative method to reference the component
  11. 	Set objFSO = CreateObject( "Scripting.FileSystemObject" )
  12. 	With objFSO
  13. 	MsgBox .GetParentFolderName( WScript.ScriptFullName )
  14. 		strWSC = .BuildPath( .GetParentFolderName( WScript.ScriptFullName ), "Whois.wsc" )
  15. 		If .FileExists( strWSC ) Then
  16. 			strWSC = "script:" & strWSC
  17. 			Set objWhois = GetObject( strWSC )
  18. 		Else
  19. 			WScript.Echo "Whois.wsc not registered, " _
  20. 			           & "nor found in current directory"
  21. 		End If
  22. 	End With
  23. 	Set objFSO = Nothing
  24. End If
  25. On Error Goto 0
  26.  
  27. ' Abort if we couldn't instantiate the object
  28. If Not IsObject( objWhois ) Then WScript.Quit
  29.  
  30. ' Set the required properties and query the Whois database
  31. objWhois.DomainName = "youtube.com"
  32. objWhois.ConnectTimeOut = 20
  33. objWhois.Debug = False
  34. objWhois.Query
  35.  
  36. ' Display the results
  37. WScript.Echo "Debug Status      : " & objWhois.Debug
  38. WScript.Echo "Domain Name       : " & objWhois.DomainName
  39. If objWhois.ErrorNumber Then
  40. 	WScript.Echo "Error Number      : " & objWhois.ErrorNumber
  41. 	WScript.Echo "Error Source      : " & objWhois.ErrorSource
  42. 	WScript.Echo "Error Description : " & objWhois.ErrorDescription
  43. Else
  44. 	WScript.Echo "Registrar         : " & objWhois.Registrar
  45. 	WScript.Echo "Whois Server      : " & objWhois.WhoisServer
  46. 	WScript.Echo "Referral URL      : " & objWhois.ReferralURL
  47. 	WScript.Echo "Name Servers      : " & objWhois.NameServers
  48. 	WScript.Echo "Status            : " & objWhois.Status
  49. 	WScript.Echo "Creation Date     : " & objWhois.CreationDate
  50. 	WScript.Echo "Last Updated      : " & objWhois.DateUpdated
  51. 	WScript.Echo "Expiration Date   : " & objWhois.ExpirationDate
  52. End If
  53.  
  54. ' Release the object
  55. Set objWhois = Nothing
  56.  

page last uploaded: 2017-07-06, 12:37