Use new connect method

This commit is contained in:
Petri Asikainen 2021-08-02 08:14:38 +03:00
parent 0afd33368b
commit ed080618a7
73 changed files with 1237 additions and 686 deletions

View file

@ -21,10 +21,10 @@ Result offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitAccessory -search Keyboard
@ -88,18 +88,27 @@ function Get-SnipeitAccessory() {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
switch($PsCmdlet.ParameterSetName) {
'Search' {$apiurl = "$url/api/v1/accessories"}
'Get by ID' {$apiurl= "$url/api/v1/accessories/$id"}
'Accessories checked out to user id' {$apiurl = "$url/api/v1/users/$user_id/accessories"}
'Search' {$api = "/api/v1/accessories"}
'Get by ID' {$api= "/api/v1/accessories/$id"}
'Accessories checked out to user id' {$api = "/api/v1/users/$user_id/accessories"}
}
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
GetParameters = $SearchParameter
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {

View file

@ -8,16 +8,15 @@
Unique ID For accessory to list
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Get-SnipeitAccessoryOwner -id 1
#>
function Get-SnipeitAccessoryOwner()
{
function Get-SnipeitAccessoryOwner() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -35,13 +34,21 @@ function Get-SnipeitAccessoryOwner()
)
$Parameters = @{
Uri = "$url/api/v1/accessories/$id/checkedout"
Api = "/api/v1/accessories/$id/checkedout"
Method = 'GET'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -30,10 +30,10 @@ Result offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitAccessory -search Keyboard
@ -92,10 +92,19 @@ function Get-SnipeitActivity() {
$Parameters = @{
Uri = "$url/api/v1/reports/activity"
Api = "/api/v1/reports/activity"
Method = 'Get'
GetParameters = $SearchParameter
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {

View file

@ -60,13 +60,13 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitAsset -all -url "https://assets.example.com"-token "token..."
Get-SnipeitAsset -all
Returens all assets
.EXAMPLE
@ -211,21 +211,30 @@ function Get-SnipeitAsset() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
switch ($PsCmdlet.ParameterSetName) {
'Search' { $apiurl = "$url/api/v1/hardware" }
'Get with id' {$apiurl= "$url/api/v1/hardware/$id"}
'Get with asset tag' {$apiurl= "$url/api/v1/hardware/bytag/$asset_tag"}
'Get with serial' { $apiurl= "$url/api/v1/hardware/byserial/$serial"}
'Assets due auditing soon' {$apiurl = "$url/api/v1/hardware/audit/due"}
'Assets overdue for auditing' {$apiurl = "$url/api/v1/hardware/audit/overdue"}
'Assets checked out to user id'{$apiurl = "$url/api/v1/users/$user_id/assets"}
'Assets with component id' {$apiurl = "$url/api/v1/components/$component_id/assets"}
'Search' { $api = "/api/v1/hardware" }
'Get with id' {$api= "/api/v1/hardware/$id"}
'Get with asset tag' {$api= "/api/v1/hardware/bytag/$asset_tag"}
'Get with serial' { $api= "/api/v1/hardware/byserial/$serial"}
'Assets due auditing soon' {$api = "/api/v1/hardware/audit/due"}
'Assets overdue for auditing' {$api = "/api/v1/hardware/audit/overdue"}
'Assets checked out to user id'{$api = "/api/v1/users/$user_id/assets"}
'Assets with component id' {$api = "/api/v1/components/$component_id/assets"}
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
GetParameters = $SearchParameter
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {

View file

@ -24,19 +24,18 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitAssetMaintenances -url "https://assets.example.com" -token "token..."
Get-SnipeitAssetMaintenances
.EXAMPLE
Get-SnipeitAssetMaintenances -search "myMachine"
.EXAMPLE
Get-SnipeitAssetMaintenances -search "myMachine" -url "https://assets.example.com" -token "token..."
.EXAMPLE
Get-SnipeitAssetMaintenances -search "myMachine" -url "https://assets.example.com" -token "token..."
Get-SnipeitAssetMaintenances -search "myMachine"
#>
function Get-SnipeitAssetMaintenance() {
Param(
@ -67,10 +66,19 @@ function Get-SnipeitAssetMaintenance() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = "$url/api/v1/maintenances"
Api = "/api/v1/maintenances"
Method = 'Get'
GetParameters = $SearchParameter
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {

View file

@ -18,10 +18,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
Url of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Url of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitCategory -id 1
@ -31,8 +31,7 @@ Get-SnipeitCategory -search "Laptop"
#>
function Get-SnipeitCategory()
{
function Get-SnipeitCategory() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -64,23 +63,32 @@ function Get-SnipeitCategory()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/categories"
$api = "/api/v1/categories"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/categories/$id"
$api= "/api/v1/categories/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -17,10 +17,10 @@ Offset to use
.PARAMETER all
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitCompany
@ -32,8 +32,7 @@ Gets specific company
#>
function Get-SnipeitCompany()
{
function Get-SnipeitCompany() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -66,23 +65,32 @@ function Get-SnipeitCompany()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/companies"
$api = "/api/v1/companies"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/companies/$id"
$api= "/api/v1/companies/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -18,10 +18,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system,can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitComponent
@ -82,23 +82,32 @@ function Get-SnipeitComponent() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/components"
$api = "/api/v1/components"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/components/$id"
$api= "/api/v1/components/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -36,10 +36,10 @@ Offset to use
A return all results
.PARAMETER url
URL of Snipeit system,can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitConsumable -all
@ -111,12 +111,21 @@ function Get-SnipeitConsumable() {
switch ($PSCmdlet.ParameterSetName) {
'Search' {
$Parameters = @{
Uri = "$url/api/v1/consumables"
Api = "/api/v1/consumables"
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter
@ -141,11 +150,21 @@ function Get-SnipeitConsumable() {
'Get with ID' {
foreach($consumable_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Api = "$url/api/v1/consumables/$consumable_id"
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
$result = Invoke-SnipeitMethod @Parameters
$result
}

View file

@ -6,18 +6,23 @@
A id of specific field
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitCustomField -url "https://assets.example.com" -token "token..."
Get-SnipeitCustomField
Get all custom fields
.EXAMPLE
Get-SnipeitCustomField -id 1
Get custom field with ID 1
#>
function Get-SnipeitCustomField()
{
function Get-SnipeitCustomField() {
Param(
[int]$id,
@ -31,17 +36,27 @@ function Get-SnipeitCustomField()
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
if ($id) {
$apiurl= "$url/api/v1/fields/$id"
$api= "/api/v1/fields/$id"
} else {
$apiurl = "$url/api/v1/fields"
$api = "/api/v1/fields"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
$result = Invoke-SnipeitMethod @Parameters

View file

@ -18,13 +18,13 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitDepartment -url "https://assets.example.com" -token "token..."
Get-SnipeitDepartment
.EXAMPLE
Get-SnipeitDepartment -search Department1
@ -34,8 +34,7 @@ Get-SnipeitDepartment -id 1
#>
function Get-SnipeitDepartment()
{
function Get-SnipeitDepartment() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -72,23 +71,32 @@ function Get-SnipeitDepartment()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/departments"
$api = "/api/v1/departments"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/departments/$id"
$api= "/api/v1/departments/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -6,16 +6,18 @@ Returns a fieldset or list of Snipe-it Fieldsets
A id of specific fieldset
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitFieldset -url "https://assets.example.com" -token "token..."
Get-SnipeitFieldset
Get all fieldsets
.EXAMPLE
Get-SnipeitFieldset -url "https://assets.example.com" -token "token..." | Where-Object {$_.name -eq "Windows" }
Get-SnipeitFieldset | Where-Object {$_.name -eq "Windows" }
Gets fieldset by name
#>
@ -33,15 +35,24 @@ function Get-SnipeitFieldset() {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
if ($id) {
$apiurl = "$url/api/v1/fieldsets/$id"
$api = "/api/v1/fieldsets/$id"
} else {
$apiurl = "$url/api/v1/fieldsets"
$api = "/api/v1/fieldsets"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
$result = Invoke-SnipeitMethod @Parameters

View file

@ -19,10 +19,10 @@ A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitLicense -search SomeLicense
@ -110,19 +110,28 @@ function Get-SnipeitLicense() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
switch($PsCmdlet.ParameterSetName) {
'Search' {$apiurl = "$url/api/v1/licenses"}
'Get with ID' {$apiurl= "$url/api/v1/licenses/$id"}
'Get licenses checked out to user ID' {$apiurl= "$url/api/v1/users/$user_id/licenses"}
'Get licenses checked out to asset ID' {$apiurl= "$url/api/v1/hardware/$asset_id/licenses"}
'Search' {$api = "/api/v1/licenses"}
'Get with ID' {$api= "/api/v1/licenses/$id"}
'Get licenses checked out to user ID' {$api= "/api/v1/users/$user_id/licenses"}
'Get licenses checked out to asset ID' {$api= "/api/v1/hardware/$asset_id/licenses"}
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -22,10 +22,10 @@ A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitLicenseSeat -id 1
@ -58,20 +58,29 @@ function Get-SnipeitLicenseSeat() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/licenses/$id/seats"
$api = "/api/v1/licenses/$id/seats"
if ($seat_id) {
$apiurl= "$url/api/v1/licenses/$id/seats/$seat_id"
$api= "/api/v1/licenses/$id/seats/$seat_id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -18,10 +18,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitLocation -search Location1
@ -31,8 +31,7 @@ Get-SnipeitLocation -id 3
#>
function Get-SnipeitLocation()
{
function Get-SnipeitLocation() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -65,23 +64,32 @@ function Get-SnipeitLocation()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/locations"
$api = "/api/v1/locations"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/locations/$id"
$api= "/api/v1/locations/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -18,10 +18,10 @@
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitManufacturer -search HP
@ -32,8 +32,7 @@
Returns manufacturer with id 3
#>
function Get-SnipeitManufacturer()
{
function Get-SnipeitManufacturer() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -66,23 +65,32 @@ function Get-SnipeitManufacturer()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/manufacturers"
$api = "/api/v1/manufacturers"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/manufacturers/$id"
$api= "/api/v1/manufacturers/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -18,10 +18,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitModel -search "DL380"
@ -31,8 +31,7 @@ Get-SnipeitModel -id 1
#>
function Get-SnipeitModel()
{
function Get-SnipeitModel() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -65,23 +64,32 @@ function Get-SnipeitModel()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/models"
$api = "/api/v1/models"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/models/$id"
$api= "/api/v1/models/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -18,10 +18,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitStatus -search "Ready to Deploy"
@ -31,8 +31,7 @@ Get-SnipeitStatus -id 3
#>
function Get-SnipeitStatus()
{
function Get-SnipeitStatus() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -65,23 +64,32 @@ function Get-SnipeitStatus()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/statuslabels"
$api = "/api/v1/statuslabels"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/statuslabels/$id"
$api= "/api/v1/statuslabels/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -18,10 +18,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitSupplier -search MySupplier
@ -30,8 +30,7 @@ Get-SnipeitSupplier -search MySupplier
Get-SnipeitSupplier -id 2
#>
function Get-SnipeitSupplier()
{
function Get-SnipeitSupplier() {
[CmdletBinding(DefaultParameterSetName = 'Search')]
Param(
[parameter(ParameterSetName='Search')]
@ -64,23 +63,32 @@ function Get-SnipeitSupplier()
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$apiurl = "$url/api/v1/suppliers"
$api = "/api/v1/suppliers"
if ($search -and $id ) {
Throw "[$($MyInvocation.MyCommand.Name)] Please specify only -search or -id parameter , not both "
}
if ($id) {
$apiurl= "$url/api/v1/suppliers/$id"
$api= "/api/v1/suppliers/$id"
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
Token = $apiKey
GetParameters = $SearchParameter
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {
$offstart = $(if ($offset) {$offset} Else {0})
$callargs = $SearchParameter

View file

@ -24,10 +24,10 @@ Offset to use
A return all results, works with -offset and other parameters
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitUser -search SomeSurname
@ -101,16 +101,25 @@ function Get-SnipeitUser() {
$SearchParameter = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
switch ($PsCmdlet.ParameterSetName) {
'Search' { $apiurl = "$url/api/v1/users"}
'Get with id' {$apiurl= "$url/api/v1/users/$id"}
'Get users a specific accessory id has been checked out to' {$apiurl= "$url/api/v1/accessories/$accessory_id/checkedout"}
'Search' { $api = "/api/v1/users"}
'Get with id' {$api= "/api/v1/users/$id"}
'Get users a specific accessory id has been checked out to' {$api= "/api/v1/accessories/$accessory_id/checkedout"}
}
$Parameters = @{
Uri = $apiurl
Api = $api
Method = 'Get'
GetParameters = $SearchParameter
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($all) {

View file

@ -57,10 +57,10 @@ Min quantity of the accessory before alert is triggered
Accessory image fileame and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitAccessory -name "Accessory" -qty 3 -category_id 1
@ -125,13 +125,22 @@ function New-SnipeitAccessory() {
}
$Parameters = @{
Uri = "$url/api/v1/accessories"
Api = "/api/v1/accessories"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -52,10 +52,10 @@ Id of target user , location or asset
Checkout asset when creating to one of following types user, location or asset.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.PARAMETER customfields
Hastable of custom fields and extra fields that need passing through to Snipeit.
@ -74,8 +74,7 @@ New-SnipeitAsset -status_id 1 -model_id 1 -name "Machine1" -customfields = @{ "_
Using customfields when creating asset.
#>
function New-SnipeitAsset()
{
function New-SnipeitAsset() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low",
@ -153,8 +152,7 @@ function New-SnipeitAsset()
$values['purchase_date'] = $values['purchase_date'].ToString("yyyy-MM-dd")
}
if ($customfields)
{
if ($customfields) {
$Values += $customfields
}
@ -172,14 +170,22 @@ function New-SnipeitAsset()
}
$Parameters = @{
Uri = "$url/api/v1/hardware"
Api = "/api/v1/hardware"
Method = 'Post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -31,10 +31,10 @@ Optional completion date
Optional cost
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitAssetMaintenence -asset_id 1 -supplier_id 1 -title "replace keyboard" -start_date 2021-01-01
@ -91,13 +91,22 @@ function New-SnipeitAssetMaintenance() {
$Parameters = @{
Uri = "$url/api/v1/maintenances"
Api = "/api/v1/maintenances"
Method = 'Post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -16,8 +16,7 @@ New-SnipeitAudit -tag 1 -location_id 1
#>
function New-SnipeitAudit()
{
function New-SnipeitAudit() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -43,20 +42,27 @@ function New-SnipeitAudit()
"location_id" = $location_id
}
if ($PSBoundParameters.ContainsKey('tag'))
{
if ($PSBoundParameters.ContainsKey('tag')) {
$Values += @{"asset_tag" = $tag}
}
$Parameters = @{
Uri = "$url/api/v1/hardware/audit"
Api = "/api/v1/hardware/audit"
Method = 'Post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -24,17 +24,16 @@ If switch is present, send email to user on checkin/checkout
Category image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
.EXAMPLE
New-SnipeitCategory -name "Laptops" -category_type asset -url "Snipe-IT URL here..." -apiKey "API key here..."
New-SnipeitCategory -name "Laptops" -category_type asset
#>
function New-SnipeitCategory()
{
function New-SnipeitCategory() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -79,14 +78,22 @@ function New-SnipeitCategory()
process {
$Parameters = @{
Uri = "$url/api/v1/categories"
Api = "/api/v1/categories"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -12,18 +12,17 @@ Comapany name
Company image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
.EXAMPLE
New-SnipeitCompany -name "Acme Company"
#>
function New-SnipeitCompany()
{
function New-SnipeitCompany() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -48,17 +47,26 @@ function New-SnipeitCompany()
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = "$url/api/v1/companies"
Api = "/api/v1/companies"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
$result
}

View file

@ -30,16 +30,15 @@ Cost of item being purchased.
Component image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
.EXAMPLE
An example
New-SnipeitComponent -name 'Display adapter' -catecory_id 3 -qty 10
.NOTES
General notes
#>
function New-SnipeitComponent() {
@ -87,13 +86,22 @@ function New-SnipeitComponent() {
}
$Parameters = @{
Uri = "$url/api/v1/components"
Api = "/api/v1/components"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -48,10 +48,10 @@ Item number for the consumable
Consumable Image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
@ -60,8 +60,7 @@ Create consumable with stock count 20 , alert when stock is 5 or lower
#>
function New-SnipeitConsumable()
{
function New-SnipeitConsumable() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -127,14 +126,22 @@ function New-SnipeitConsumable()
process {
$Parameters = @{
Uri = "$url/api/v1/consumables"
Api = "/api/v1/consumables"
Method = 'Post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -30,17 +30,16 @@
Any additional text you wish to display under the new form field to make it clearer what the gauges should be.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitCustomField -Name "AntivirusInstalled" -Format "BOOLEAN" -HelpText "Is AntiVirus installed on Asset"
#>
function New-SnipeitCustomField()
{
function New-SnipeitCustomField() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -84,16 +83,22 @@ function New-SnipeitCustomField()
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = "$url/api/v1/fields"
Api = "/api/v1/fields"
Method = 'post'
Body = $Values
Token = $apiKey
}
if ($PSBoundParameters.ContainsKey('apiKey')) {
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Set-SnipeitPSSessionApiKey -url $url
}
}
process{
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -21,10 +21,10 @@
Department Image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
@ -66,13 +66,22 @@ function New-SnipeitDepartment() {
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = "$url/api/v1/departments"
Api = "/api/v1/departments"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -57,10 +57,10 @@
Termination date for license.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitLicence -name "License" -seats 3 -company_id 1
@ -141,13 +141,22 @@ function New-SnipeitLicense() {
}
$Parameters = @{
Uri = "$url/api/v1/licenses"
Api = "/api/v1/licenses"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -42,10 +42,10 @@
Location Image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitLocation -name "Room 1" -address "123 Asset Street" -parent_id 14
@ -98,13 +98,22 @@ function New-SnipeitLocation() {
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = "$url/api/v1/locations"
Api = "/api/v1/locations"
Method = 'post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -15,17 +15,16 @@
Remove current image
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitManufacturer -name "HP"
#>
function New-SnipeitManufacturer()
{
function New-SnipeitManufacturer() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -54,14 +53,22 @@ function New-SnipeitManufacturer()
}
$Parameters = @{
Uri = "$url/api/v1/manufacturers"
Api = "/api/v1/manufacturers"
Method = 'post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -24,17 +24,16 @@
Asset model Image filename and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
#>
function New-SnipeitModel()
{
function New-SnipeitModel() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -81,14 +80,22 @@ function New-SnipeitModel()
$Parameters = @{
Uri = "$url/api/v1/models"
Api = "/api/v1/models"
Method = 'post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -45,10 +45,10 @@
Image file name and path for item
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
@ -102,13 +102,22 @@ function New-SnipeitSupplier() {
$Values = . Get-ParameterValue -Parameters $MyInvocation.MyCommand.Parameters -BoundParameters $PSBoundParameters
$Parameters = @{
Uri = "$url/api/v1/suppilers"
Api = "/api/v1/suppilers"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -54,10 +54,10 @@
User Image file name and path
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
New-Snipeituser -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
@ -126,13 +126,22 @@ function New-SnipeitUser() {
}
$Parameters = @{
Uri = "$url/api/v1/users"
Api = "/api/v1/users"
Method = 'post'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -6,10 +6,10 @@
.PARAMETER ID
Unique ID For accessory to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitAccessory -ID 44 -Verbose
@ -18,8 +18,7 @@
Get-SnipeitAccessory -search needle | Remove-SnipeitAccessory
#>
function Remove-SnipeitAccessory ()
{
function Remove-SnipeitAccessory () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitAccessory ()
process {
foreach($accessory_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/accessories/$accessory_id"
Api = "/api/v1/accessories/$accessory_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,10 +6,10 @@
.PARAMETER ID
Unique ID For Asset to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitAsset -ID 44 -Verbose
@ -18,8 +18,7 @@
Get-SnipeitAsset -serial 123456789 | Remove-SnipeitAsset
#>
function Remove-SnipeitAsset ()
{
function Remove-SnipeitAsset () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -43,15 +42,24 @@ function Remove-SnipeitAsset ()
process {
foreach($asset_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/hardware/$asset_id"
Api = "/api/v1/hardware/$asset_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -1,4 +1,3 @@
function Remove-SnipeitAssetMaintenance {
<#
.SYNOPSIS
Remove asset maintenance from Snipe-it asset system
@ -10,14 +9,15 @@ function Remove-SnipeitAssetMaintenance {
Unique ID of the asset maintenance to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER url
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitAssetMaintenance -ID 44 -url $url -apiKey $secret -Verbose
Remove-SnipeitAssetMaintenance -ID 44
#>
function Remove-SnipeitAssetMaintenance {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -41,13 +41,21 @@ function Remove-SnipeitAssetMaintenance {
process {
foreach($maintenance_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/maintenances/$maintenance_id"
Api = "/api/v1/maintenances/$maintenance_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For categoryto be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitCategory -ID 44 -Verbose
Remove-SnipeitCategory -ID 44
.EXAMPLE
Get-SnipeitCategory -search something | Remove-SnipeitCategory
#>
function Remove-SnipeitCategory ()
{
function Remove-SnipeitCategory () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -41,15 +40,24 @@ function Remove-SnipeitCategory ()
process {
foreach($category_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/categories/$category_id"
Api = "/api/v1/categories/$category_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For Company to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitCompany -ID 44 -Verbose
Remove-SnipeitCompany -ID 44
.EXAMPLE
Get-SnipeitCompany | | Where-object {$_.name -like '*some*'} | Remove-SnipeitCompany
#>
function Remove-SnipeitCompany ()
{
function Remove-SnipeitCompany () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -41,15 +40,24 @@ function Remove-SnipeitCompany ()
process {
foreach($company_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/companies/$company_id"
Api = "/api/v1/companies/$company_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER IDs
Unique ID For component to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitComponent -ID 44 -Verbose
Remove-SnipeitComponent -ID 44
.EXAMPLE
Get-SnipeitComponent -search 123456789 | Remove-SnipeitComponent
#>
function Remove-SnipeitComponent ()
{
function Remove-SnipeitComponent () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitComponent ()
process {
foreach($component_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/components/$component_id"
Api = "/api/v1/components/$component_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -7,20 +7,19 @@
Unique ID For consumable to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitConsumable -ID 44 -Verbose
Remove-SnipeitConsumable -ID 44
.EXAMPLE
Get-SnipeitConsumable -search "paper" | Remove-Snipeitconsumable
Get-SnipeitConsumable -search "paper" | Remove-SnipeitConsumable
#>
function Remove-SnipeitConsumable ()
{
function Remove-SnipeitConsumable () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -43,15 +42,24 @@ function Remove-SnipeitConsumable ()
process {
foreach($consumable_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Api = "/api/v1/consumables/$consumable_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,10 +6,10 @@
.PARAMETER ID
Unique ID For field to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitCustomField -ID 44 -Verbose
@ -18,8 +18,7 @@
Get-SnipeitCustomField | Where-object {$_.name -like '*address*'} | Remove-SnipeitCustomField
#>
function Remove-SnipeitCustomField ()
{
function Remove-SnipeitCustomField () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -40,15 +39,24 @@ function Remove-SnipeitCustomField ()
process {
foreach($field_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/fields/$field_id"
Api = "/api/v1/fields/$field_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For department to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitDepartment -ID 44 -Verbose
Remove-SnipeitDepartment -ID 44
.EXAMPLE
Get-SnipeitDepartment | Where-object {$_.name -like '*head*'} | Remove-SnipeitDepartment
#>
function Remove-SnipeitDepartment ()
{
function Remove-SnipeitDepartment () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -41,15 +40,24 @@ function Remove-SnipeitDepartment ()
process {
foreach($department_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/departments/$department_id"
Api = "/api/v1/departments/$department_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For licence to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitLicence -ID 44 -Verbose
Remove-SnipeitLicence -ID 44
.EXAMPLE
Get-SnipeitLicence -product_key 123456789 | Remove-SnipeitLicense
#>
function Remove-SnipeitLicense ()
{
function Remove-SnipeitLicense () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitLicense ()
process {
foreach($license_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/licenses/$license_id"
Api = "/api/v1/licenses/$license_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For location to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitLocation -ID 44 -Verbose
Remove-SnipeitLocation -ID 44
.EXAMPLE
Get-SnipeitLocation -city Arkham | Remove-SnipeitLocation
#>
function Remove-SnipeitLocation ()
{
function Remove-SnipeitLocation () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitLocation ()
process {
foreach($location_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/locations/$asset_id"
Api = "/api/v1/locations/$asset_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For manufacturer to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitManufacturer -ID 44 -Verbose
Remove-SnipeitManufacturer -ID 44
.EXAMPLE
Get-SnipeitManufacturer | Where-object {$_.name -like '*something*'} | Remove-SnipeitManufacturer
#>
function Remove-SnipeitManufacturer ()
{
function Remove-SnipeitManufacturer () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitManufacturer ()
process {
foreach($manufacturer_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/manufacturers/$manufacturer_id"
Api = "/api/v1/manufacturers/$manufacturer_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,20 +6,19 @@
.PARAMETER ID
Unique ID For Model to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitModel -ID 44 -Verbose
Remove-SnipeitModel -ID 44
.EXAMPLE
Get-SnipeitModel -search needle | Remove-SnipeitModel
#>
function Remove-SnipeitModel ()
{
function Remove-SnipeitModel () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitModel ()
process {
foreach($model_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/models/$model_id"
Api = "/api/v1/models/$model_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -6,10 +6,10 @@
.PARAMETER ID
Unique ID For supplier to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitSupplier -ID 44
@ -18,8 +18,7 @@
Get-SnipeitSupplier | Where-object {$_.name -like '*something*'} | Remove-SnipeitSupplier
#>
function Remove-SnipeitSupplier ()
{
function Remove-SnipeitSupplier () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -42,15 +41,24 @@ function Remove-SnipeitSupplier ()
process {
foreach($suppliers_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/suppliers/$supplier_id"
Api = "/api/v1/suppliers/$supplier_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result
}
}

View file

@ -7,17 +7,16 @@
Unique ID For User to be removed
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose
#>
function Remove-SnipeitUser ()
{
function Remove-SnipeitUser () {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -41,13 +40,21 @@ function Remove-SnipeitUser ()
process {
foreach($user_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/users/$user_id"
Api = "/api/v1/users/$user_id"
Method = 'Delete'
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -10,10 +10,10 @@
Use Get-SnipeitAccessoryOwner to find out nooded value
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
To get the accessories_users table for specific accessory id number
@ -25,8 +25,7 @@
Get-SnipeitAccessoryOwner -assigned_pivot_id xxx
#>
function Reset-SnipeitAccessoryOwner()
{
function Reset-SnipeitAccessoryOwner() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -44,14 +43,22 @@ function Reset-SnipeitAccessoryOwner()
)
$Parameters = @{
Uri = "$url/api/v1/accessories/$assigned_pivot_id/checkin"
Api = "/api/v1/accessories/$assigned_pivot_id/checkin"
Method = 'Post'
Body = @{}
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -17,13 +17,11 @@
Notes about checkin
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Remove-SnipeitUser -ID 44 -url $url -apiKey $secret -Verbose
Remove-SnipeitUser -ID 44
#>
function Reset-SnipeitAssetOwner() {
[CmdletBinding(
@ -58,13 +56,22 @@ function Reset-SnipeitAssetOwner() {
if ($PSBoundParameters.ContainsKey('status_id')) { $Values.Add("status_id", $status_id) }
$Parameters = @{
Uri = "$url/api/v1/hardware/$id/checkin"
Api = "/api/v1/hardware/$id/checkin"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -54,11 +54,10 @@ Remove current image
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfoeItInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Set-SnipeitAccessory -id 1 -qty 3
@ -128,13 +127,22 @@ function Set-SnipeitAccessory() {
process {
foreach($accessory_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/accessories/$accessory_id"
Api = "/api/v1/accessories/$accessory_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -14,16 +14,15 @@
Notes about checkout
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Set-SnipeitAccessoryOwner -id 1 -assigned_id 1 -note "testing check out to user"
#>
function Set-SnipeitAccessoryOwner()
{
function Set-SnipeitAccessoryOwner() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -51,14 +50,22 @@ function Set-SnipeitAccessoryOwner()
process {
foreach($accessory_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/accessories/$accessory_id/checkout"
Api = "/api/v1/accessories/$accessory_id/checkout"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -63,10 +63,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfoeItInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.PARAMETER customfields
Hastable of custom fields and extra fields that need passing through to Snipeit
@ -81,8 +81,7 @@
Get-SnipeitAsset -serial 12345678 | Set-SnipeitAsset -notes 'Just updated'
#>
function Set-SnipeitAsset()
{
function Set-SnipeitAsset() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -151,8 +150,7 @@ function Set-SnipeitAsset()
$Values['purchase_date'] = $Values['purchase_date'].ToString("yyyy-MM-dd")
}
if ($customfields)
{
if ($customfields) {
$Values += $customfields
}
@ -161,14 +159,22 @@ function Set-SnipeitAsset()
process {
foreach($asset_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/hardware/$asset_id"
Api = "/api/v1/hardware/$asset_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -28,16 +28,15 @@
Optional date to override the checkout time of now
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Set-SnipeitAssetOwner -id 1 -assigned_id 1 -checkout_to_type user -note "testing check out to user"
#>
function Set-SnipeitAssetOwner()
{
function Set-SnipeitAssetOwner() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -81,8 +80,7 @@ function Set-SnipeitAssetOwner()
$Values['checkout_at'] = $Values['checkout_at'].ToString("yyyy-MM-dd")
}
switch ($checkout_to_type)
{
switch ($checkout_to_type) {
'location' { $Values += @{ "assigned_location" = $assigned_id } }
'user' { $Values += @{ "assigned_user" = $assigned_id } }
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
@ -96,14 +94,22 @@ function Set-SnipeitAssetOwner()
process{
foreach($asset_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/hardware/$asset_id/checkout"
Api = "/api/v1/hardware/$asset_id/checkout"
Method = 'POST'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -30,17 +30,16 @@ Remove current image
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
.EXAMPLE
Set-SnipeitCategory -id 4 -name "Laptops"
#>
function Set-SnipeitCategory()
{
function Set-SnipeitCategory() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -88,14 +87,22 @@ function Set-SnipeitCategory()
process {
foreach($category_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/categories/$category_id"
Api = "/api/v1/categories/$category_id"
Method = $RequestType
Body = $values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -21,10 +21,10 @@ Remove current image
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
.EXAMPLE
An example
@ -32,8 +32,7 @@ An example
.NOTES
General notes
#>
function Set-SnipeitCompany()
{
function Set-SnipeitCompany() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -68,14 +67,22 @@ function Set-SnipeitCompany()
process{
foreach($company_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/companies/$company_id"
Api = "/api/v1/companies/$company_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -42,19 +42,17 @@ Remove current image
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key API Key for Snipeit.
.EXAMPLE
An example
Set-SnipeitComponent -id 42 -qty 12
Sets count of component with ID 42 to 12
.NOTES
General notes
#>
function Set-SnipeitComponent()
{
function Set-SnipeitComponent() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -109,14 +107,22 @@ function Set-SnipeitComponent()
process {
foreach($component_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/components/$component_id"
Api = "/api/v1/components/$component_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -57,10 +57,10 @@ Remove current image
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
@ -69,8 +69,7 @@ Create consumable with stock count 20 , alert when stock is 5 or lower
#>
function Set-SnipeitConsumable()
{
function Set-SnipeitConsumable() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -148,14 +147,22 @@ function Set-SnipeitConsumable()
process {
foreach($consumable_id in $id ) {
$Parameters = @{
Uri = "$url/api/v1/consumables/$consumable_id"
Api = "/api/v1/consumables/$consumable_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -33,17 +33,16 @@
Http request type to send Snipe IT system. Defaults to Put you could use Patch if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitCustomField -Name "AntivirusInstalled" -Format "BOOLEAN" -HelpText "Is AntiVirus installed on Asset"
#>
function Set-SnipeitCustomField()
{
function Set-SnipeitCustomField() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -93,14 +92,22 @@ function Set-SnipeitCustomField()
process{
foreach($field_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/fields/$field_id"
Api = "/api/v1/fields/$field_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -30,10 +30,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Set-SnipeitDepartment -id 4 -manager_id 3
@ -83,13 +83,22 @@ function Set-SnipeitDepartment() {
process {
foreach ($department_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/departments/$department_id"
Api = "/api/v1/departments/$department_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -1,14 +1,16 @@
<#
.SYNOPSIS
Sets authetication information
Sets authetication information. Deprecated, use Connect-SnipeitPS instead.
.DESCRIPTION
Set apikey and url user to connect Snipe-It system
Deprecated combatibilty function that Set apikey and url user to connect Snipe-It system.
Please use Connect-SnipeitPS instead.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
User's API Key for Snipeit.
.EXAMPLE
Set-SnipeitInfo -url $url -apiKey -Verbose
@ -17,50 +19,18 @@ function Set-SnipeitInfo {
[CmdletBinding()]
[System.Diagnostics.CodeAnalysis.SuppressMessage('PSUseShouldProcessForStateChangingFunctions', '')]
param (
[parameter(Mandatory=$true)]
[Uri]$url,
[parameter(Mandatory=$true)]
[String]$apiKey
)
BEGIN {
Test-SnipeitAlias -invocationName $MyInvocation.InvocationName -commandName $MyInvocation.MyCommand.Name
function Add-DefaultParameter {
param(
[Parameter(Mandatory = $true)]
[string]$Command,
[Parameter(Mandatory = $true)]
[string]$Parameter,
[Parameter(Mandatory = $true)]
$Value
)
PROCESS {
#Write-Verbose "[$($MyInvocation.MyCommand.Name)] Setting [$command : $parameter] = $value"
# Needs to set both global and module scope for the private functions:
# http://stackoverflow.com/questions/30427110/set-psdefaultparametersvalues-for-use-within-module-scope
$PSDefaultParameterValues["${command}:${parameter}"] = $Value
$global:PSDefaultParameterValues["${command}:${parameter}"] = $Value
}
}
$moduleCommands = Get-Command -Module SnipeitPS -CommandType Function
Write-Warning "Deprecated $($MyInvocation.InvocationName) is still working, please use Connect-SnipeitPS instead."
}
PROCESS {
foreach ($command in $moduleCommands) {
$parameter = "url"
if ($url -and ($command.Parameters.Keys -contains $parameter)) {
Add-DefaultParameter -Command $command -Parameter $parameter -Value ($url.AbsoluteUri.TrimEnd('/'))
}
$parameter = "apiKey"
if ($apiKey -and ($command.Parameters.Keys -contains $parameter)) {
Add-DefaultParameter -Command $command -Parameter $parameter -Value $apiKey
}
}
Connect-SnipeitPS -Url $url -apiKey $apiKey
}
}

View file

@ -63,10 +63,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Set-SnipeitLicence -name "License" -seats 3 -company_id 1
@ -156,13 +156,22 @@ function Set-SnipeitLicense() {
process {
foreach($license_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/licenses/$license_id"
Api = "/api/v1/licenses/$license_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -20,10 +20,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Set-SnipeitLicenceSeat -ID 1 -seat_id 1 -assigned_id 3
@ -38,8 +38,7 @@
Checkin licence seat id 1 of licence id 1
#>
function Set-SnipeitLicenseSeat()
{
function Set-SnipeitLicenseSeat() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -78,14 +77,22 @@ function Set-SnipeitLicenseSeat()
process{
foreach($license_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/licenses/$license_id/seats/$seat_id"
Api = "/api/v1/licenses/$license_id/seats/$seat_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?"))
{
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -54,10 +54,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Set-SnipeitLocation -id 123 -name "Some storage" -parent_id 100
@ -121,13 +121,22 @@ function Set-SnipeitLocation() {
process{
foreach ($location_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/locations/$location_id"
Api = "/api/v1/locations/$location_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -18,17 +18,16 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitManufacturer -name "HP"
#>
function Set-SnipeitManufacturer()
{
function Set-SnipeitManufacturer() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -62,13 +61,22 @@ function Set-SnipeitManufacturer()
process{
foreach ($manufacturer_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/manufacturers/$manufacturer_id"
Api = "/api/v1/manufacturers/$manufacturer_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -33,10 +33,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitModel -name "DL380" -manufacturer_id 2 -fieldset_id 2 -category_id 1
@ -90,13 +90,22 @@ function Set-SnipeitModel() {
process {
foreach ($model_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/models/$model_id"
Api = "/api/v1/models/$model_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -19,10 +19,10 @@ Hex code showing what color the status label should be on the pie chart in the d
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
Get-SnipeitStatus -search "Ready to Deploy"
@ -32,8 +32,7 @@ Set-SnipeitStatus -id 3 -name 'Waiting for arrival' -type pending
#>
function Set-SnipeitStatus()
{
function Set-SnipeitStatus() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Medium"
@ -73,13 +72,22 @@ function Set-SnipeitStatus()
process {
foreach($status_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/statuslabels/$status_id"
Api = "/api/v1/statuslabels/$status_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}
$result

View file

@ -51,10 +51,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
Users API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. Users API Key for Snipeit.
.EXAMPLE
New-SnipeitDepartment -name "Department1" -company_id 1 -localtion_id 1 -manager_id 3
@ -117,13 +117,22 @@ function Set-SnipeitSupplier() {
process {
foreach ($supplier_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/suppliers/$supplier_id"
Api = "/api/v1/suppliers/$supplier_id"
Method = $RequestType
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -63,10 +63,10 @@
Http request type to send Snipe IT system. Defaults to Patch you could use Put if needed.
.PARAMETER url
URL of Snipeit system, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. URL of Snipeit system.
.PARAMETER apiKey
User's API Key for Snipeit, can be set using Set-SnipeitInfo command
Deprecated parameter, please use Connect-SnipeitPS instead. User's API Key for Snipeit.
.EXAMPLE
Update-SnipeitUser -id 3 -fist_name It -lastname Snipe -username snipeit -activated $false -company_id 1 -location_id 1 -department_id 1
@ -144,13 +144,22 @@ function Set-SnipeitUser() {
process{
foreach($user_id in $id) {
$Parameters = @{
Uri = "$url/api/v1/users/$user_id"
Api = "/api/v1/users/$user_id"
Method = 'PATCH'
Body = $Values
Token = $apiKey
}
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSBoundParameters.ContainsKey('apiKey')) {
Write-Warning "-apiKey parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -apiKey $apikey
}
if ($PSBoundParameters.ContainsKey('url')) {
Write-Warning "-url parameter is deprecated, please use Connect-SnipeitPS instead."
Set-SnipeitPSSessionApiKey -url $url
}
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
$result = Invoke-SnipeitMethod @Parameters
}

View file

@ -15,8 +15,7 @@ Replaces old command from file "your-script.ps1" and creates new script "new-scr
After testing new file you can replace old file with new.
#>
function Update-SnipeitAlias()
{
function Update-SnipeitAlias() {
[CmdletBinding(
SupportsShouldProcess = $true,
ConfirmImpact = "Low"
@ -34,7 +33,7 @@ function Update-SnipeitAlias()
}
process {
If ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
if ($PSCmdlet.ShouldProcess("ShouldProcess?")) {
ForEach ($st in $String) {
$result = $st
ForEach ($key in $SnipeitAliases.Keys ) {