Hi @Robert Little ,
I am not sure what happens here with the Select-String -Pattern $AppInstanceName
in you code. If I remember right the output of Select-String
is a string or boolean.
This would not work with the next pipe Sort-Object
because Sort-Object
expects objects and not strings.
What is the output of $itemsToDelete = get-childitem -Path $AppInstanceRootPath -Exclude $AppInstanceName | Select-String -Pattern $AppInstanceName
without the Sort-Object
and the Select-Object
?
----------
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten