I am trying filter by the name of each share using $Share.Name. However, when I try to use -contains in the if statement below, I get no r
$Share.Name
-contains
if
If you are testing $name for exactly 'admin' you can use the -eq comparator. This checks if the contents of $name equal the contents of your specified string 'admin'
$name
-eq