I’m trying to use a script which I downloaded from the Microsoft Script Repository and have already tested the syntax on a single user’s directory. However, I need to use it to process ALL user directories and yet not delete the user directories themselves. So the logic I’m trying to use is that all subfolders within the container “\Server1\shared_BizHub_Users” should be passed into the script named deleteold.ps1. I’m still learning PowerShell so I’m pretty sure I’ve got some syntax errors in both of my two options to solve this problem.
the immediate child objects user the path \Server1\shared_BizHub_Users folder is a folder for each user in the enterprise. For example,
In both Option 1 and Option 2 I’m fairly certain that i’m not passing the variable for the -FolderPath parameter for deleteold.ps1 correctly. Any help would be greatly appreciated! When I ran deleteold.ps1 and manually specified the full UNC path to a specific users folder, it ran as expected using the same variables shown below. I’m merely trying to pass the Folder Path as a variable using a loop.