-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathReport-ProfilePath.ps1
More file actions
32 lines (31 loc) · 1.01 KB
/
Copy pathReport-ProfilePath.ps1
File metadata and controls
32 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<#
.Synopsis
Do all the eactive directory accounts have the correct profile path
.DESCRIPTION
If any profile path is set, does it also contains the users account name.
Troubleshooting an issue where users seems to randomly get another users profiles set for them at logoff.
.EXAMPLE
Report-ProfilePath
Got 1371 users
Problems on:
SamAccountName ProfilePath
-------------- -----------
07test \\uhserver1\users$\08test\profile.v2
#>
function Report-ProfilePath
{
Process
{
$result = get-aduser -filter * -properties "SamAccountName","ProfilePath" -OutVariable users |
where {($psitem.profilePath -ne $null) -and ($psitem.ProfilePath -notmatch $psitem.SamAccountName)}
}
End{
Write-Output "Got $($users.count) users"
if($result){
Write-Output "Problems on:"
Write-Output $result | select SamAccountName, ProfilePath
} else {
Write-Output "No incorrect profiles found"
}
}
}