Functions/NetworkAreas/Remove-PVTrustedNetworkArea.ps1
Function Remove-PVTrustedNetworkArea { <# .SYNOPSIS Deletes a Trusted Network Area from a CyberArk Vault environment. .DESCRIPTION Exposes the PACLI Function: "DELETETRUSTEDNETWORKAREA" .PARAMETER vault The defined Vault name .PARAMETER user The Username of the authenticated User. .PARAMETER trusterName The User whose access to the Trusted Network Area will be removed. .PARAMETER networkArea The name of the Trusted Network Area to delete. .PARAMETER sessionID The ID number of the session. Use this parameter when working with multiple scripts simultaneously. The default is ‘0’. .EXAMPLE Remove-PVTrustedNetworkArea -vault Lab -user administrator -trusterName cnAdmin -networkArea All\Vendor Deletes Trusted Network Area "Vendor" from cnAdmin account .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)] [Alias("Username")] [string]$trusterName, [Parameter( Mandatory = $True, ValueFromPipelineByPropertyName = $True)] [string]$networkArea, [Parameter( Mandatory = $False, ValueFromPipelineByPropertyName = $True)] [int]$sessionID ) PROCESS { $Return = Invoke-PACLICommand $Script:PV.ClientPath DELETETRUSTEDNETWORKAREA $($PSBoundParameters.getEnumerator() | ConvertTo-ParameterString) if($Return.ExitCode -eq 0) { Write-Verbose "Trusted Network Area $NetworkArea Removed from $trusterName" [PSCustomObject] @{ "vault" = $vault "user" = $user "sessionID" = $sessionID } | Add-ObjectDetail -TypeName pacli.PoShPACLI } } } |