Functions/UserMangement/Remove-PVLocation.ps1
Function Remove-PVLocation { <# .SYNOPSIS Deletes a Location .DESCRIPTION Exposes the PACLI Function: "DELETELOCATION" .PARAMETER vault The defined Vault name .PARAMETER user The Username of the authenticated User. .PARAMETER location The name of the location to delete. Note: Add a backslash ‘\’ before the name of the location .PARAMETER sessionID The ID number of the session. Use this parameter when working with multiple scripts simultaneously. The default is ‘0’. .EXAMPLE Remove-PVLocation -vault Lab -user administrator -location \x51 Deletes location "x51" from the vault .NOTES AUTHOR: Pete Maan #> [CmdLetBinding(SupportsShouldProcess)] [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "ShouldProcess handling is in Invoke-PACLICommand")] param( [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$vault, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$user, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$location, [Parameter( Mandatory = $False, ValueFromPipelineByPropertyName = $True)] [int]$sessionID ) PROCESS { $Return = Invoke-PACLICommand $Script:PV.ClientPath DELETELOCATION $($PSBoundParameters.getEnumerator() | ConvertTo-ParameterString) if($Return.ExitCode -eq 0) { Write-Verbose "Deleted Location $location" [PSCustomObject] @{ "vault" = $vault "user" = $user "sessionID" = $sessionID } | Add-ObjectDetail -TypeName pacli.PoShPACLI } } } |