Scripts/Set-BPAFolder.ps1

function Set-BPAFolder {
    <#
        .SYNOPSIS
            Sets properties of an AutoMate BPA folder.
 
        .DESCRIPTION
            Set-BPAFolder can change properties of a folder object.
 
        .PARAMETER InputObject
            The object to modify.
 
        .PARAMETER Notes
            The new notes to set on the object.
 
        .EXAMPLE
            # Modify folder notes
            Get-BPAFolder Test | Set-BPAFolder -Notes "This folder contains test workflows"
 
        .NOTES
            Author(s): : David Seibel
            Contributor(s) :
            Date Created : 09/12/2017
            Date Modified : 03/27/2018
 
        .LINK
            https://github.com/davidseibel/PoshBPA
    #>

    [CmdletBinding(SupportsShouldProcess=$true,ConfirmImpact='Medium')]
    param(
        [Parameter(Mandatory = $true, ValueFromPipeline = $true)]
        $InputObject,

        [Parameter(Mandatory = $true)]
        [AllowEmptyString()]
        [string]$Notes
    )
    PROCESS {
        foreach ($obj in $InputObject) {
            if ($obj.TypeName -eq "Folder") {
                $updateObject = Get-BPAFolder -ID $obj.ID -BPAServer $obj.BPAServer
                $shouldUpdate = $false
                if ($PSBoundParameters.ContainsKey("Notes")) {
                    if ($updateObject.Notes -ne $Notes) {
                        $updateObject.Notes = $Notes
                        $shouldUpdate = $true
                    }
                }
                if ($shouldUpdate) {
                    $updateObject | Set-BPAObject
                } else {                            
                    Write-Verbose "$($obj.TypeName) '$($obj.Name)' already contains the specified values."
                }
            } else {
                Write-Error -Message "Unsupported input type '$($obj.TypeName)' encountered!" -TargetObject $obj
            }
        }
    }
}