What am I missing…?

$ProfilePath = "C:Users" $UserFoldersCatchAll = Get-ChildItem $ProfilePath | Select Name $UserFolders = @() #Array to hold "good" user folder names ForEach ($Folder in $UserFoldersCatchAll.Name) { If ($Folder.ToString() -Like ("*.NET*" -OR "*Administrator*" -OR "*MSSQL*")) { #Filter out the garbage Write-Verbose "$Folder does not appear to be a user folder" } Else { $UserFolders += $Folder #Add good folders to the array } } 

Items named .NET v4.5, .NET v4.5 Classic, Administrator are still in the $UserFolders array. I don’t understand why!

submitted by /u/IDA_noob
[link] [comments]

Leave a Reply