Functions/FoldersFiles/Move-PVFolder.ps1
Function Move-PVFolder { <# .SYNOPSIS Moves a folder to a different location within the same Safe. .DESCRIPTION Exposes the PACLI Function: "MOVEFOLDER" .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 move. .PARAMETER folder The name of the folder. .PARAMETER newLocation The new location of the folder. 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 Move-PVFolder -vault lab -user administrator -safe ComplianceReports -folder root\reports\2017 ` -newLocation root Moves folder "2017"to the root location of the 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 = $True, ValueFromPipelineByPropertyName = $True)] [string]$newLocation, [Parameter( Mandatory = $False, ValueFromPipelineByPropertyName = $True)] [int]$sessionID ) PROCESS { $Return = Invoke-PACLICommand $Script:PV.ClientPath MOVEFOLDER $($PSBoundParameters.getEnumerator() | ConvertTo-ParameterString) if($Return.ExitCode -eq 0) { Write-Verbose "Moved Folder to $newLocation" [PSCustomObject] @{ "vault" = $vault "user" = $user "sessionID" = $sessionID } | Add-ObjectDetail -TypeName pacli.PoShPACLI } } } |