jdhitsolutions / PSScriptTools

:wrench: :hammer: A set of PowerShell functions you might use to enhance your own functions and scripts or to facilitate working in the console. Most should work in both Windows PowerShell and PowerShell 7, even cross-platform. Any operating system limitations should be handled on a per command basis. The Samples folder contains demonstration script files
MIT License
891 stars 112 forks source link

[Bug]: Invoke-RestMethod error on Get-WhoIs #151

Open Douda opened 1 month ago

Douda commented 1 month ago

Describe the problem

Get-WhoIs fails with a specific IP passed

Install-Module PSScriptTools

Get-WhoIs -IPAddress 8.8.8.8

Name IP      RegisteredOrganization NetBlocks  Updated
---- --      ---------------------- ---------  -------
GOGL 8.8.8.8 Google LLC             8.8.8.0/24 28/12/2023 23:24:56

# Testing specific IP

Get-WhoIs -IPAddress 154.62.105.215
Invoke-RestMethod: C:\Users\Douda\Documents\PowerShell\Modules\PSScriptTools\2.50.0\functions\Get-WhoIs.ps1:53
Line |
  53 |  …                    = (Invoke-RestMethod $r.net.orgRef.'#text').org.ci …
     |                                            ~~~~~~~~~~~~~~~~~~~~~
     | Cannot validate argument on parameter 'Uri'. The argument is null or empty. Provide an argument that is not null
     | or empty, and then try the command again.

Expectation

No response

Additional Information

$PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.4.3
PSEdition                      Core
GitCommitId                    7.4.3
OS                             Microsoft Windows 10.0.22631
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PowerShell version

Other

Platform

Windows 11 Pro or Enterprise

Additional Checks

jdhitsolutions commented 1 month ago

Looks like I need a little error handling.