Jan 17 2021 10:26 AM
how can i have uniqe return for below code, i need the true value onlye
$Folder = Get-ChildItem -Path C:\10 -Directory | % {$_.Name -eq 'Test'}
foreach($Folders in $Folder)
{
$Folders
}
current result im getting
False
True
False
False
Jan 17 2021 12:26 PM
Hi
you can use
$Folders | where {$_ -like $true}
in the foreach block instead of only $Folders.
---------------
if you find this answer helpful, please click on Best response and give like :)