PassThru is a switch which wen enabled passes the resultant file system items to the pipeline. It makes sense to not pass the file system item directory, instead that should be a property on a returned PSCustomObject. This way we can add more items to the object, like whether or not there was a rename (ie the trigger flag). By adding the trigger to the custom object, we can resolve the issue of a batch run where WhatIf is enabled meaning that the renamed item does not actually exist.
So the returned PassThru PSCustomObject will contain the following properties
When WhatIf not enabled:
OriginalName
RenamedFsItem: the file system object; the renamed object if renamed, or the original if not
Rename: the new name if renamed, missing if not
Trigger
ParentPath (directory)
When WhatIf enabled:
OriginalName
RenamedFsItem: the file system object; the renamed object if renamed, or the original if not
PassThru is a switch which wen enabled passes the resultant file system items to the pipeline. It makes sense to not pass the file system item directory, instead that should be a property on a returned PSCustomObject. This way we can add more items to the object, like whether or not there was a rename (ie the trigger flag). By adding the trigger to the custom object, we can resolve the issue of a batch run where WhatIf is enabled meaning that the renamed item does not actually exist.
So the returned PassThru PSCustomObject will contain the following properties
When WhatIf not enabled:
When WhatIf enabled: