Pass PSBoundParameters

This commit is contained in:
Petri Asikainen 2021-06-07 21:27:10 +03:00
parent d4c138604d
commit 064ff9c4ed
37 changed files with 43 additions and 36 deletions

View file

@ -25,6 +25,8 @@ function Get-ParameterValue {
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
$Parameters $Parameters
, ,
[parameter(mandatory = $true)]
$BoundParameters,
[string[]]$DefaultExcludeParameter = @("id", "url", "apiKey", 'Debug', 'Verbose','RequestType','customfields') [string[]]$DefaultExcludeParameter = @("id", "url", "apiKey", 'Debug', 'Verbose','RequestType','customfields')
) )
@ -40,11 +42,16 @@ function Get-ParameterValue {
try { try {
$key = $parameter.Key $key = $parameter.Key
if ($key -notin $DefaultExcludeParameter) { if ($key -notin $DefaultExcludeParameter) {
#Fill in default parameters values
if ($null -ne ($value = Get-Variable -Name $key -ValueOnly -ErrorAction Ignore )) { if ($null -ne ($value = Get-Variable -Name $key -ValueOnly -ErrorAction Ignore )) {
if ($value -ne ($null -as $parameter.Value.ParameterType)) { if ($value -ne ($null -as $parameter.Value.ParameterType)) {
$ParameterValues[$key] = $value $ParameterValues[$key] = $value
} }
} }
#Fill in all given parameters even empty
if ($BoundParameters.ContainsKey($key)) {
$ParameterValues[$key] = $BoundParameters[$key]
}
} }
} }

View file

@ -65,7 +65,7 @@ function Get-SnipeItAccessory() {
) )
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{ $Parameters = @{
Uri = "$url/api/v1/accessories" Uri = "$url/api/v1/accessories"

View file

@ -88,7 +88,7 @@ function Get-SnipeItActivity() {
throw "Please specify both item_type and item_id" throw "Please specify both item_type and item_id"
} }
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{ $Parameters = @{

View file

@ -120,7 +120,7 @@ function Get-SnipeItAsset() {
) )
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/hardware" $apiurl = "$url/api/v1/hardware"

View file

@ -64,7 +64,7 @@ function Get-SnipeItAssetMaintenance() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{ $Parameters = @{
Uri = "$url/api/v1/maintenances" Uri = "$url/api/v1/maintenances"

View file

@ -55,7 +55,7 @@ function Get-SnipeItCategory()
) )
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/categories" $apiurl = "$url/api/v1/categories"

View file

@ -57,7 +57,7 @@ function Get-SnipeItCompany()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/companies" $apiurl = "$url/api/v1/companies"

View file

@ -70,7 +70,7 @@ function Get-SnipeItComponent() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/components" $apiurl = "$url/api/v1/components"

View file

@ -62,7 +62,7 @@ function Get-SnipeItDepartment()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/departments" $apiurl = "$url/api/v1/departments"

View file

@ -81,7 +81,7 @@ function Get-SnipeItLicense() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/licenses" $apiurl = "$url/api/v1/licenses"

View file

@ -56,7 +56,7 @@ function Get-SnipeItLicenseSeat() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/licenses/$id/seats" $apiurl = "$url/api/v1/licenses/$id/seats"

View file

@ -56,7 +56,7 @@ function Get-SnipeitLocation()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/locations" $apiurl = "$url/api/v1/locations"

View file

@ -58,7 +58,7 @@ function Get-SnipeItManufacturer()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/manufacturers" $apiurl = "$url/api/v1/manufacturers"

View file

@ -56,7 +56,7 @@ function Get-SnipeItModel()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/models" $apiurl = "$url/api/v1/models"

View file

@ -56,7 +56,7 @@ function Get-SnipeItStatus()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/statuslabels" $apiurl = "$url/api/v1/statuslabels"

View file

@ -56,7 +56,7 @@ function Get-SnipeItSupplier()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/suppliers" $apiurl = "$url/api/v1/suppliers"

View file

@ -78,7 +78,7 @@ function Get-SnipeItUser() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$SearchParameter = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/users" $apiurl = "$url/api/v1/users"

View file

@ -107,7 +107,7 @@ function New-SnipeItAccessory() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) { if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd") $values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")

View file

@ -125,7 +125,7 @@ function New-SnipeItAsset()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) { if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd") $values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")

View file

@ -79,7 +79,7 @@ function New-SnipeItAssetMaintenance() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['start_date']) { if ($values['start_date']) {
$values['start_date'] = $values['start_date'].ToString("yyyy-MM-dd") $values['start_date'] = $values['start_date'].ToString("yyyy-MM-dd")

View file

@ -39,7 +39,7 @@ function New-SnipeItCompany()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;

View file

@ -69,7 +69,7 @@ function New-SnipeItComponent() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) { if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd") $values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")

View file

@ -48,7 +48,7 @@ function New-SnipeItCustomField()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
#Convert Values to JSON format #Convert Values to JSON format
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;

View file

@ -55,7 +55,7 @@ function New-SnipeItDepartment() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;

View file

@ -126,7 +126,7 @@ function New-SnipeItLicense() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['expiration_date']) { if ($values['expiration_date']) {
$values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd") $values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd")

View file

@ -87,7 +87,7 @@ function New-SnipeItLocation() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;

View file

@ -111,7 +111,7 @@ function New-SnipeItUser() {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($password ) { if ($password ) {
$Values['password_confirmation'] = $password $Values['password_confirmation'] = $password

View file

@ -106,7 +106,7 @@ function Set-SnipeItAccessory() {
begin { begin {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) { if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd") $values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")

View file

@ -45,7 +45,7 @@ function Set-SnipeItAccessoryOwner()
[string]$apiKey [string]$apiKey
) )
begin{ begin{
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;
} }

View file

@ -130,7 +130,7 @@ function Set-SnipeItAsset()
begin{ begin{
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) { if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd") $values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")

View file

@ -68,7 +68,7 @@ function Set-SnipeItAssetOwner()
begin{ begin{
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($Values['expected_checkin']) { if ($Values['expected_checkin']) {
$Values['expected_checkin'] = $values['expected_checkin'].ToString("yyyy-MM-dd") $Values['expected_checkin'] = $values['expected_checkin'].ToString("yyyy-MM-dd")

View file

@ -71,7 +71,7 @@ function Set-SnipeItComponent()
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['purchase_date']) { if ($values['purchase_date']) {
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd") $values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")

View file

@ -131,7 +131,7 @@ function Set-SnipeItLicense() {
begin{ begin{
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
if ($values['expiration_date']) { if ($values['expiration_date']) {
$values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd") $values['expiration_date'] = $values['expiration_date'].ToString("yyyy-MM-dd")

View file

@ -59,7 +59,7 @@ function Set-SnipeItLicenseSeat()
) )
begin{ begin{
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;
} }

View file

@ -98,7 +98,7 @@ function Set-SnipeitLocation() {
begin{ begin{
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;
} }

View file

@ -69,7 +69,7 @@ function Set-SnipeItModel() {
begin { begin {
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;
} }

View file

@ -109,7 +109,7 @@ function Set-SnipeItUser() {
begin{ begin{
Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name Test-SnipeItAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
$Values = . Get-ParameterValue $MyInvocation.MyCommand.Parameters $Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;
} }