Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Filtering a compare-object output

$
0
0

I have a compare that produces both <= and => results called $Differences. I want to filter out those that are => and from the result, which is a path, I want the bit on the end, which should be the SamAccountName of a AD user that I then plan to search for.

I get back nothing though so I think my Split-Path isn't getting the correct or any input to apply -Leaf to

The output of the compare looks something like:

InputObject                                      SideIndicator

--------------                                     --------------

\\SuppHome\SuppHome$\supnbwl   =>

This is the bit of my script I'm having trouble with

$Differences = Compare-Object $HomeDirectory  $HomeFolders

$Differences | Where-Object {$_.SideIndicator -eq "=>"} | Foreach-Object{
$ADUuser=Split-Path $_.InputObject -Leaf
Get-ADUser $ADUser | select DisplayName
}

 

 

 

 

 

 


Viewing all articles
Browse latest Browse all 6937

Trending Articles