From 7e8cd796cde3a82c6578f552792e3aedb157d7c0 Mon Sep 17 00:00:00 2001 From: Marius Storhaug Date: Sun, 28 Jan 2024 02:59:37 +0100 Subject: [PATCH] Fix --- src/PublicIP/PublicIP.psd1 | 22 ++++++++++------------ src/PublicIP/public/Get-GeoLocation.ps1 | 11 +++++++++++ src/PublicIP/public/Get-IPConfig.ps1 | 11 +++++++++++ src/PublicIP/public/Get-PublicIP.ps1 | 16 +++++++++++++++- src/PublicIP/public/Restore-IPConfig.ps1 | 10 ++++++++++ src/PublicIP/public/Save-IPConfig.ps1 | 11 +++++++++++ 6 files changed, 68 insertions(+), 13 deletions(-) diff --git a/src/PublicIP/PublicIP.psd1 b/src/PublicIP/PublicIP.psd1 index b78a4f0..6d56148 100644 --- a/src/PublicIP/PublicIP.psd1 +++ b/src/PublicIP/PublicIP.psd1 @@ -1,15 +1,13 @@ @{ - # Author of this module - Author = 'Marius Storhaug' - - # Company or vendor of this module - CompanyName = 'Marius Storhaug' + # Version number of this module + ModuleVersion = '0.1.0' # Description of the functionality provided by this module - Description = 'PowerShell Module for Public IP' + Description = 'PowerShell Module for Public IP' - # Private data to pass to the module specified in RootModule/ModuleToProcess. This may also contain a PSData hashtable with additional module metadata used by PowerShell. - PrivateData = @{ + # Private data to pass to the module specified in RootModule/ModuleToProcess. + # This may also contain a PSData hashtable with additional module metadata used by PowerShell. + PrivateData = @{ PSData = @{ @@ -17,19 +15,19 @@ Tags = @('PublicIP', 'IP', 'Public', 'IPConfig', 'Config') # A URL to the license for this module. - LicenseUri = 'https://github.com/MariusStorhaug/PublicIP/blob/main/LICENSE' + LicenseUri = 'https://github.com/PSModule/PublicIP/blob/main/LICENSE' # A URL to the main website for this project. - ProjectUri = 'https://github.com/MariusStorhaug/PublicIP' + ProjectUri = 'https://github.com/PSModule/PublicIP' # A URL to an icon representing this module. - IconUri = 'https://raw.githubusercontent.com/MariusStorhaug/PublicIP/main/icon/PowerShell_Core_6.0_icon.png' + IconUri = 'https://raw.githubusercontent.com/PSModule/PublicIP/main/icon/PowerShell_Core_6.0_icon.png' } # End of PSData hashtable } # End of PrivateData hashtable # HelpInfo URI of this module - HelpInfoURI = 'https://mariusstorhaug.github.io/PublicIP' + HelpInfoURI = 'https://PSModule.github.io/PublicIP' } diff --git a/src/PublicIP/public/Get-GeoLocation.ps1 b/src/PublicIP/public/Get-GeoLocation.ps1 index 87b2c72..d81dd95 100644 --- a/src/PublicIP/public/Get-GeoLocation.ps1 +++ b/src/PublicIP/public/Get-GeoLocation.ps1 @@ -1,4 +1,15 @@ function Get-GeoLocation { + <# + .SYNOPSIS + Gets the current location of the device. + + .DESCRIPTION + Gets the current location of the device. + + .EXAMPLE + Get-GeoLocation + #> + Add-Type -AssemblyName System.Device #Required to access System.Device.Location namespace $GeoWatcher = New-Object System.Device.Location.GeoCoordinateWatcher #Create the required object $GeoWatcher.Start() #Begin resolving current locaton diff --git a/src/PublicIP/public/Get-IPConfig.ps1 b/src/PublicIP/public/Get-IPConfig.ps1 index 3963927..f5303bb 100644 --- a/src/PublicIP/public/Get-IPConfig.ps1 +++ b/src/PublicIP/public/Get-IPConfig.ps1 @@ -1,4 +1,15 @@ function Get-IPConfig { + <# + .SYNOPSIS + Gets the current IP configuration. + + .DESCRIPTION + Gets the current IP configuration. + + .EXAMPLE + Get-IPConfig + #> + $PublicIP = Get-PublicIP $Time = Get-Date -Format yyyyMMdd-hhmmss.fffff $Location = Get-GeoLocation diff --git a/src/PublicIP/public/Get-PublicIP.ps1 b/src/PublicIP/public/Get-PublicIP.ps1 index 8bd3d8a..9d0b6b7 100644 --- a/src/PublicIP/public/Get-PublicIP.ps1 +++ b/src/PublicIP/public/Get-PublicIP.ps1 @@ -1,6 +1,20 @@ function Get-PublicIP { + <# + .SYNOPSIS + Gets your public IP address. + + .DESCRIPTION + Gets your public IP address. You can specify a provider to use by using the Provider parameter. + + .EXAMPLE + Get-PublicIP + + .EXAMPLE + Get-PublicIP -Provider MyIP + #> param( - [Parameter(Mandatory = $false)] + # The provider to use to get the public IP address. + [Parameter()] [ValidateScript({ $providerMap.Keys })] $Provider = 'IPInfo' ) diff --git a/src/PublicIP/public/Restore-IPConfig.ps1 b/src/PublicIP/public/Restore-IPConfig.ps1 index 13d439b..5216602 100644 --- a/src/PublicIP/public/Restore-IPConfig.ps1 +++ b/src/PublicIP/public/Restore-IPConfig.ps1 @@ -1,4 +1,14 @@ function Restore-IPConfig { + <# + .SYNOPSIS + Restores the IPConfig from the file. + + .DESCRIPTION + Restores the IPConfig from the file. + + .EXAMPLE + Restore-IPConfig + #> if (Test-Path -Path $IPConfigFilePath) { return Get-Content -Path $IPConfigFilePath | ConvertFrom-Json } diff --git a/src/PublicIP/public/Save-IPConfig.ps1 b/src/PublicIP/public/Save-IPConfig.ps1 index d5790f6..b98e77f 100644 --- a/src/PublicIP/public/Save-IPConfig.ps1 +++ b/src/PublicIP/public/Save-IPConfig.ps1 @@ -1,4 +1,15 @@ function Save-IPConfig { + <# + .SYNOPSIS + Saves the current public ip to a file. + + .DESCRIPTION + Saves the current public ip to a file. + If the file does not exist, it will be created. + + .EXAMPLE + Save-IPConfig + #> $IPConfig = @() $RestoredIPConfig = Restore-IPConfig if ($null -ne $RestoredIPConfig) {