WhoIs PowerShell function will perform a domain name lookup and return information such as domain availability (creation and expiration date), domain ownership, name servers, etc..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
PS C:\> whois power-shell.com Connecting to Web Services URL... Ok Gathering power-shell.com data... Whois Server Version 2.0 Domain names in the .com and .net domains can now be registered with many different competing registrars. Go to http://www.internic.net for detailed information. Domain Name: POWER-SHELL.COM Registrar: GODADDY.COM, LLC Whois Server: whois.godaddy.com Referral URL: http://registrar.godaddy.com Name Server: NS83.SUPERHOSTING.BG Name Server: NS84.SUPERHOSTING.BG Status: clientDeleteProhibited Status: clientRenewProhibited Status: clientTransferProhibited Status: clientUpdateProhibited Updated Date: 02-nov-2014 Creation Date: 17-oct-2014 Expiration Date: 17-oct-2015 >>> Last update of whois database: Sat, 20 Dec 2014 17:56:21 GMT |
Add this function to a module or save it as ps1 file and dot source it in your profile:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
Function WhoIs { param ( [Parameter(Mandatory=$True, HelpMessage='Please enter domain name (e.g. microsoft.com)')] [string]$domain ) Write-Host "Connecting to Web Services URL..." -ForegroundColor Green try { If ($whois = New-WebServiceProxy -uri "http://www.webservicex.net/whois.asmx?WSDL") {Write-Host "Ok" -ForegroundColor Green} else {Write-Host "Error" -ForegroundColor Red} Write-Host "Gathering $domain data..." -ForegroundColor Green (($Whois.getwhois(=$domain)).Split("<<<")[0]) } catch { Write-Host "Please enter valid domain name (e.g. microsoft.com)." -ForegroundColor Red} } |