Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MariusStorhaug committed Jan 28, 2024
1 parent 51a6642 commit 7e8cd79
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 13 deletions.
22 changes: 10 additions & 12 deletions src/PublicIP/PublicIP.psd1
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
@{
# 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 = @{

# Tags applied to this module. These help with module discovery in online galleries.
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'

}
11 changes: 11 additions & 0 deletions src/PublicIP/public/Get-GeoLocation.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
11 changes: 11 additions & 0 deletions src/PublicIP/public/Get-IPConfig.ps1
Original file line number Diff line number Diff line change
@@ -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
Expand Down
16 changes: 15 additions & 1 deletion src/PublicIP/public/Get-PublicIP.ps1
Original file line number Diff line number Diff line change
@@ -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'
)
Expand Down
10 changes: 10 additions & 0 deletions src/PublicIP/public/Restore-IPConfig.ps1
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
11 changes: 11 additions & 0 deletions src/PublicIP/public/Save-IPConfig.ps1
Original file line number Diff line number Diff line change
@@ -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) {
Expand Down

0 comments on commit 7e8cd79

Please sign in to comment.