mirror of
https://github.com/snazy2000/SnipeitPS.git
synced 2025-12-13 18:02:30 +00:00
add set-snipeitcompany
This commit is contained in:
parent
ac842e3d6a
commit
621ee76709
1 changed files with 70 additions and 0 deletions
70
SnipeitPS/Public/Set-SnipeitCompany.ps1
Normal file
70
SnipeitPS/Public/Set-SnipeitCompany.ps1
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<#
|
||||
.SYNOPSIS
|
||||
Updates company name
|
||||
|
||||
.DESCRIPTION
|
||||
Updates companyt name on Snipe-It system
|
||||
|
||||
.PARAMETER id
|
||||
ID number of company
|
||||
|
||||
.PARAMETER name
|
||||
Company name
|
||||
|
||||
.PARAMETER url
|
||||
URL of Snipeit system, can be set using Set-SnipeitInfo command
|
||||
|
||||
.PARAMETER apiKey
|
||||
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
|
||||
|
||||
.EXAMPLE
|
||||
An example
|
||||
|
||||
.NOTES
|
||||
General notes
|
||||
#>
|
||||
function Set-SnipeitCompany()
|
||||
{
|
||||
[CmdletBinding(
|
||||
SupportsShouldProcess = $true,
|
||||
ConfirmImpact = "Medium"
|
||||
)]
|
||||
|
||||
Param(
|
||||
[parameter(mandatory = $true,ValueFromPipelineByPropertyName)]
|
||||
[int[]]$id,
|
||||
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$name,
|
||||
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$url,
|
||||
|
||||
[parameter(mandatory = $true)]
|
||||
[string]$apiKey
|
||||
)
|
||||
|
||||
begin{
|
||||
$values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
|
||||
|
||||
$Body = $values | ConvertTo-Json;
|
||||
}
|
||||
|
||||
process{
|
||||
foreach($company_id in $id){
|
||||
$Parameters = @{
|
||||
Uri = "$url/api/v1/companies/$companyid"
|
||||
Method = 'Patch'
|
||||
Body = $Body
|
||||
Token = $apiKey
|
||||
}
|
||||
|
||||
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
|
||||
{
|
||||
$result = Invoke-SnipeitMethod @Parameters
|
||||
}
|
||||
|
||||
$result
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue