Merge pull request #259 from snazy2000/develop

Added:  Next Audit Date to New-SnipeItAudit.ps1
This commit is contained in:
Petri Asikainen 2022-02-05 13:41:20 +02:00 committed by GitHub
commit f3391bb521
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 4 deletions

View file

@ -8,6 +8,9 @@ Long description
.PARAMETER Tag .PARAMETER Tag
The asset tag of the asset you wish to audit The asset tag of the asset you wish to audit
.PARAMETER next_audit_date
Due date for the asset's next audit
.PARAMETER Location_id .PARAMETER Location_id
ID of the location you want to associate with the audit ID of the location you want to associate with the audit
@ -28,6 +31,9 @@ function New-SnipeitAudit() {
[int]$location_id, [int]$location_id,
[parameter(mandatory = $false)]
[datetime]$next_audit_date,
[parameter(mandatory = $false)] [parameter(mandatory = $false)]
[string]$url, [string]$url,
@ -46,6 +52,10 @@ function New-SnipeitAudit() {
$Values += @{"asset_tag" = $tag} $Values += @{"asset_tag" = $tag}
} }
if ($PSBoundParameters.ContainsKey('next_audit_date')) {
$Values += @{"next_audit_date" = ($next_audit_date).ToString("yyyy-MM-dd")}
}
$Parameters = @{ $Parameters = @{
Api = "/api/v1/hardware/audit" Api = "/api/v1/hardware/audit"
Method = 'Post' Method = 'Post'

View file

@ -13,8 +13,8 @@ Add a new Audit to Snipe-it asset system
## SYNTAX ## SYNTAX
``` ```
New-SnipeitAudit [-tag] <String> [[-location_id] <Int32>] [[-url] <String>] [[-apiKey] <String>] [-WhatIf] New-SnipeitAudit [-tag] <String> [[-location_id] <Int32>] [[-next_audit_date] <DateTime>] [[-url] <String>]
[-Confirm] [<CommonParameters>] [[-apiKey] <String>] [-WhatIf] [-Confirm] [<CommonParameters>]
``` ```
## DESCRIPTION ## DESCRIPTION
@ -38,7 +38,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 4 Position: 5
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
@ -59,6 +59,21 @@ Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False
``` ```
### -next_audit_date
Due date for the asset's next audit
```yaml
Type: DateTime
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
```
### -tag ### -tag
The asset tag of the asset you wish to audit The asset tag of the asset you wish to audit
@ -83,7 +98,7 @@ Parameter Sets: (All)
Aliases: Aliases:
Required: False Required: False
Position: 3 Position: 4
Default value: None Default value: None
Accept pipeline input: False Accept pipeline input: False
Accept wildcard characters: False Accept wildcard characters: False