mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
merged changes
This commit is contained in:
commit
9562ab3d46
37 changed files with 43 additions and 36 deletions
|
|
@ -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]
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ function Get-SnipeItAccessory() {
|
||||||
throw "Please specify only one of -id or -search parameter"
|
throw "Please specify only one of -id or -search parameter"
|
||||||
}
|
}
|
||||||
|
|
||||||
$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"
|
||||||
|
|
|
||||||
|
|
@ -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 = @{
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,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"
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -64,7 +64,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,7 +90,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"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -74,7 +74,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")
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,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")
|
||||||
|
|
|
||||||
|
|
@ -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")
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,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")
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,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")
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue