I have this code. When I look for my profile it finds over 1,000 machines which I know it not accurate. But when I search for any other users ID it finds nothing.
$user1="arorat"
$Path="c:\users\arorat"
$Log="\\server1\d$\tools\logging\arorat"
$pc= (Get-ADComputer-Filter*-SearchBase"ou=mg_workstations,dc=acme,dc=org").Name
foreach($machinein$pc) {If (Test-Path$Path) {$user1 | Out-File"$log\$machine.txt"} }
What I think is happening is for every machine in $pc it sees my "local" profile (i.e. C:\Users\MyID) and that is why I get over 1,000 returns.
my goal is to find all machines users arorat has a profile on.