Forum Discussion
PS1Exprt_IMHD
Jan 17, 2021Copper Contributor
uniqe value
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
- 1975Copper Contributor
3788PS1Exprt_IMHD
- farismalaebSteel Contributor
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 🙂