Functions/FoldersFiles/Add-PVPreferredFolder.ps1
Function Add-PVPreferredFolder { <# .SYNOPSIS Enables specification of a preferred folder in a Safe. .DESCRIPTION Exposes the PACLI Function: "ADDPREFERREDFOLDER" .PARAMETER vault The defined Vault name .PARAMETER user The Username of the authenticated User. .PARAMETER safe The name of the Safe containing the folder to mark. .PARAMETER folder The name of the folder to mark as a preferred folder. .PARAMETER sessionID The ID number of the session. Use this parameter when working with multiple scripts simultaneously. The default is ‘0’. .EXAMPLE Add-PVPreferredFolder -vault lab -user administrator -safe AuditReports -folder root\reports\2017 Sets preferred folder in AuditReports safe. .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 = $False, ValueFromPipelineByPropertyName = $True)] [int]$sessionID ) PROCESS { $Return = Invoke-PACLICommand $Script:PV.ClientPath ADDPREFERREDFOLDER $($PSBoundParameters.getEnumerator() | ConvertTo-ParameterString) if($Return.ExitCode -eq 0) { Write-Verbose "Preferred Folder Set" [PSCustomObject] @{ "vault" = $vault "user" = $user "sessionID" = $sessionID } | Add-ObjectDetail -TypeName pacli.PoShPACLI } } } |