Hey all, I'm trying to cobble together a script that will delete non-active profiles, and here's what I have so far:
$userfolders = gci c:\users\ | select-object name $qwinsta = get-rdpsession $activesessions = $qwinsta.username $compare = compare-object -includeequal -property name $userfolders $activesessions
The "get-rdpsession" cmdlet can be found here
Anyhow, output ends up looking like this:
name SideIndicator
---- -------------
=>
=>
=>
=>
=>
=>
Classic .NET AppPool <=
Public <=
s10772n <=
s11428n <=
s11761n <=
s11949n <=
s13364n <=
s13699d <=
s13923n <=
s14929n <=
s16612d <=
s16612d <=
s16612d <=
s17450n <=
s17754n <=
s18539n <=
s18718d <=
s18732n <=
s19064n <=
s20072n <=
s20286n <=
s21079d <=
s21286n <=
s21306n <=
s21378n <=
S22002D <=
S22002D <=
s22164n <=
s23090n <=
s23156n <=
s23529d <= As you can see it's not showing any matches, despite the values of $userfolders and $activesessions to contain two matches. I'm guessing those variables are containing more than text, and I'm thus comparing unlike things?
Thanks.
zarberg@gmail.com