pwsh/Show-WhoIs.ps1

Set-Alias -Name whois -Value Show-WhoIs
function Show-WhoIs {
  [CmdletBinding()]
  param(
    [Parameter(Mandatory, Position=0, ValueFromPipeline)]
    [ValidateNotNullOrEmpty()]
    [String]$Domain,

    [Parameter()][Switch]$UseAlternative
  )

  process {
    $params = @{
      Uri = "https://www.$((('virustotal.com/vtapi/v2/domain/report?apikey=' +
         '4e3202fdbe953d628f650229af5b3eb49cd46b2d3bfe5546ae3c5fa48b554e0c&' +
        `"domain=$Domain`"),'nic.ru/app/v1/get/whois'
      )[!!$UseAlternative])"

      Method = ('GET', 'POST')[!!$UseAlternative]
    }

    if ($UseAlternative) {
      $params.Body = "{`"searchWord`":`"$Domain`"}"
      $params.ContentType = 'application/json;charset=UTF-8'
    }

    if (($res = Invoke-WebRequest @params).StatusCode -ne 200) {
      throw [InvalidOperationException]::new($res.StatusDescription)
    }

    $res = ConvertFrom-Json -InputObject $res.Content
    switch ($UseAlternative) {
      $true  {
        $res.body.list.ForEach{
          "Registry: $($_.registry)"
          .({
            foreach ($item in $_.formatted) {
              "$($item.name) $($item.value -replace '<[^>]*>')"
            }
            ''
          }, {$_.html -replace '<[^>]*>'})[!!$_.html]
        }
      }
      $false { $res.whois }
    } # switch
  }
}

Export-ModuleMember -Alias whois -Function Show-WhoIs