Functions/FoldersFiles/Reset-PVFile.ps1

Function Reset-PVFile {

    <#
    .SYNOPSIS
    Reset the access marks on the specified file or password.

    .DESCRIPTION
    Exposes the PACLI Function: "RESETFILE"

    .PARAMETER safe
    The name of the Safe in which the file is stored.

    .PARAMETER folder
    The name of the folder in which the file is stored.

    .PARAMETER file
    The name of the file or password to reset.

    .EXAMPLE
    Reset-PVFile -safe EU_Admins -folder root -file eu.credential

    Reset access mark on eu.credential file

    .NOTES
    AUTHOR: Pete Maan

    #>


    [CmdLetBinding(SupportsShouldProcess)]
    [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSShouldProcess", "", Justification = "ShouldProcess handling is in Invoke-PACLICommand")]
    param(

        [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
    )

    PROCESS {

        $Return = Invoke-PACLICommand $Script:PV.ClientPath RESETFILE $($PSBoundParameters | ConvertTo-ParameterString)

        if ($Return.ExitCode -eq 0) {

            [PSCustomObject] @{

                "Safename" = $safe
                "Folder"   = $folder
                "Filename" = $file

            }

        }

    }

}