Functions/FoldersFiles/Add-PVFileCategory.ps1
Function Add-PVFileCategory { <# .SYNOPSIS Adds a predefined File Category at Vault or Safe level to a file. .DESCRIPTION Exposes the PACLI Function: "ADDFILECATEGORY" .PARAMETER vault The defined Vault name .PARAMETER user The Username of the authenticated User. .PARAMETER safe The name of the Safe that the File Category is being added to. .PARAMETER folder The folder containing a file with a File Category attached to it. .PARAMETER file The name of the file or password that is attached to a File Category. .PARAMETER category The name of the File Category. .PARAMETER value The value of the File Category for the file. .PARAMETER sessionID The ID number of the session. Use this parameter when working with multiple scripts simultaneously. The default is ‘0’. .EXAMPLE Add-PVFileCategory -vault Lab -user administrator -safe DEV -folder Root -file SYSPass ` -category Criticality -value 7 Adds predefined file category Criticality, with a value of 7 to file SYSPass in safe DEV .NOTES AUTHOR: Pete Maan #> [CmdLetBinding()] param( [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$vault, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$user, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [Alias("Safename")] [string]$safe, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$folder, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [Alias("Filename")] [string]$file, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$category, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$value, [Parameter( Mandatory = $False, ValueFromPipelineByPropertyName = $True)] [int]$sessionID ) PROCESS { $Return = Invoke-PACLICommand $Script:PV.ClientPath ADDFILECATEGORY $($PSBoundParameters.getEnumerator() | ConvertTo-ParameterString) if($Return.ExitCode -eq 0) { Write-Verbose "File Category Added" [PSCustomObject] @{ "vault" = $vault "user" = $user "sessionID" = $sessionID } | Add-ObjectDetail -TypeName pacli.PoShPACLI } } } |