ExtendFunction
0.10.0
Apteco PS Modules - PowerShell functions extension
This function helps to gather all parameters that a function/cmdlet has
except the common parameters like -verbose etc.
This can be used to extend existing functions/cmdlets with more scripting
and possibly additional parameters.
So in this example you see how it works
```PowerShell
# These functions
This function helps to gather all parameters that a function/cmdlet has
except the common parameters like -verbose etc.
This can be used to extend existing functions/cmdlets with more scripting
and possibly additional parameters.
So in this example you see how it works
```PowerShell
# These functions
Apteco PS Modules - PowerShell functions extension
This function helps to gather all parameters that a function/cmdlet has
except the common parameters like -verbose etc.
This can be used to extend existing functions/cmdlets with more scripting
and possibly additional parameters.
So in this example you see how it works
```PowerShell
# These functions inherit the parameters of the original functions/cmdlets
# And as an example adds an additional parameter
# There are two functions for the different PowerShell Editions
function Invoke-DesktopWebRequest {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)][String]$AdditionalString
)
DynamicParam { Get-BaseParameters "Invoke-WebRequest" }
Process {
Write-Host "Using `$PSEdition: Desktop"
Write-Host $AdditionalString
$updatedParameters = Skip-UnallowedBaseParameters -Base "Invoke-WebRequest" -Parameters $PSBoundParameters
Invoke-WebRequest @updatedParameters
}
}
function Invoke-CoreWebRequest {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)][String]$AdditionalString
)
DynamicParam { Get-BaseParameters "Invoke-WebRequest" }
Process {
Write-Host "Using `$PSEdition: Core"
Write-Host $AdditionalString
$updatedParameters = Skip-UnallowedBaseParameters -Base "Invoke-WebRequest" -Parameters $PSBoundParameters
Invoke-WebRequest @updatedParameters
}
}
```
And this can be used like
```PowerShell
#-----------------------------------------------
# CREATE AN ALIAS DEPENDING ON $PSEdition
#-----------------------------------------------
# In this example differentiates between Core and Desktop, but creates one alias for different $PSEdition
# Just type $PSEdition if you want to know which edition you are using
Switch ( $PSEdition ) {
"Desktop" {
Set-Alias -Name Invoke-WebRequestExtended -Value Invoke-DesktopWebRequest -Force
}
"Core" {
Set-Alias -Name Invoke-WebRequestExtended -Value Invoke-CoreWebRequest -Force
}
}
#-----------------------------------------------
# EXAMPLE TO LOAD DATA WITH THE NEW ALIAS
#-----------------------------------------------
$myParams = [Hashtable]@{
Uri = "https://api.chucknorris.io/jokes/random"
Method = "Get"
Verbose = $true
AdditionalString = "Hello World"
}
$wr = Invoke-WebRequestExtended @myParams
( $wr.content | ConvertFrom-Json ).Value
```
Show more
This function helps to gather all parameters that a function/cmdlet has
except the common parameters like -verbose etc.
This can be used to extend existing functions/cmdlets with more scripting
and possibly additional parameters.
So in this example you see how it works
```PowerShell
# These functions inherit the parameters of the original functions/cmdlets
# And as an example adds an additional parameter
# There are two functions for the different PowerShell Editions
function Invoke-DesktopWebRequest {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)][String]$AdditionalString
)
DynamicParam { Get-BaseParameters "Invoke-WebRequest" }
Process {
Write-Host "Using `$PSEdition: Desktop"
Write-Host $AdditionalString
$updatedParameters = Skip-UnallowedBaseParameters -Base "Invoke-WebRequest" -Parameters $PSBoundParameters
Invoke-WebRequest @updatedParameters
}
}
function Invoke-CoreWebRequest {
[CmdletBinding()]
param (
[Parameter(Mandatory=$true)][String]$AdditionalString
)
DynamicParam { Get-BaseParameters "Invoke-WebRequest" }
Process {
Write-Host "Using `$PSEdition: Core"
Write-Host $AdditionalString
$updatedParameters = Skip-UnallowedBaseParameters -Base "Invoke-WebRequest" -Parameters $PSBoundParameters
Invoke-WebRequest @updatedParameters
}
}
```
And this can be used like
```PowerShell
#-----------------------------------------------
# CREATE AN ALIAS DEPENDING ON $PSEdition
#-----------------------------------------------
# In this example differentiates between Core and Desktop, but creates one alias for different $PSEdition
# Just type $PSEdition if you want to know which edition you are using
Switch ( $PSEdition ) {
"Desktop" {
Set-Alias -Name Invoke-WebRequestExtended -Value Invoke-DesktopWebRequest -Force
}
"Core" {
Set-Alias -Name Invoke-WebRequestExtended -Value Invoke-CoreWebRequest -Force
}
}
#-----------------------------------------------
# EXAMPLE TO LOAD DATA WITH THE NEW ALIAS
#-----------------------------------------------
$myParams = [Hashtable]@{
Uri = "https://api.chucknorris.io/jokes/random"
Method = "Get"
Verbose = $true
AdditionalString = "Hello World"
}
$wr = Invoke-WebRequestExtended @myParams
( $wr.content | ConvertFrom-Json ).Value
```
Minimum PowerShell version
5.1
Installation Options
Owners
Copyright
(c) 2025 Apteco GmbH. All rights reserved.
Package Details
Author(s)
- florian.von.bracht@apteco.de
Tags
Functions
Get-BaseParameter Skip-UnallowedBaseParameter
PSEditions
Dependencies
This module has no dependencies.
Release Notes
0.10.0 Some cosmetic changes and adding aliases for the functions
0.9.1 Updated copyright to 2025
0.9.0 Initial release of extending functions module through psgallery
FileList
- ExtendFunction.nuspec
- Public\Skip-UnallowedBaseParameter.ps1
- ExtendFunction.psm1
- Public\Get-BaseParameter.ps1
- ExtendFunction.psd1
Version History
| Version | Downloads | Last updated |
|---|---|---|
| 0.10.0 (current version) | 9 | 12/8/2025 |
| 0.9.1 | 44 | 9/23/2025 |
| 0.9.0 | 438 | 11/3/2022 |