This script can query specified active directory users whether or not a roaming profile was configured.
IT admins may care about which users has a roaming profile was configured. This script can help IT admins check whether or not a roaming profile was configured.
Step 1: Run the script in the Windows PowerShell Console, type the command: Import-Module <Script Path> at the prompt. For example, type Import-Module C:\Script\CheckIfProfileExists.psm1
This is shown in the following figure.
Step 2: Type the command Get-Help
Get-OSCADUserRoamingProfile -Full to display the entire help file for this function, such as the syntax, parameters, or examples.
Here are some code snippets for your references. To get the complete script sample, please click the download button at the beginning of this page.
If($SamAccountName)
{
Foreach($Name in $SamAccountName)
{
If((Get-ADUser -Filter {SamAccountName -like $Name}) -ne $null)
{
$Obj = Get-ADUser -Filter {SamAccountName -like $Name} -Properties ProfilePath | Select SamAccountName, `
@{Name = "ProfileExists";Expression={$_.ProfilePath -like "\\*"}},`
@{Name = "RoamingProfilePath";Expression={If($_.ProfilePath -eq $null){"None"}Else{$_.ProfilePath}}}, `
@{Name = "RoamingProfileSize";Expression={IF($_.ProfilePath -eq $null){"None"}Else `
{$Items = (Get-ChildItem -Path $_.ProfilePath -Recurse | `
Measure-Object -Property Length -Sum);'{0:N2}' -f ($Items.Sum/1MB)+" MB"}}}
$Objs += $Obj
}
Else
{
Write-Warning "Not found '$Name', please check your input is correct."
}
}
#Shows the output
$Objs
}
If($SamAccountName) { Foreach($Name in $SamAccountName) { If((Get-ADUser -Filter {SamAccountName -like $Name}) -ne $null) { $Obj = Get-ADUser -Filter {SamAccountName -like $Name} -Properties ProfilePath | Select SamAccountName, ` @{Name = "ProfileExists";Expression={$_.ProfilePath -like "\\*"}},` @{Name = "RoamingProfilePath";Expression={If($_.ProfilePath -eq $null){"None"}Else{$_.ProfilePath}}}, ` @{Name = "RoamingProfileSize";Expression={IF($_.ProfilePath -eq $null){"None"}Else ` {$Items = (Get-ChildItem -Path $_.ProfilePath -Recurse | ` Measure-Object -Property Length -Sum);'{0:N2}' -f ($Items.Sum/1MB)+" MB"}}} $Objs += $Obj } Else { Write-Warning "Not found '$Name', please check your input is correct."}} #Shows the output $Objs }
Example 1: Type Get-OSCADUserRoamingProfile command in the Windows PowerShell Console.

This command lists all AD users’ roaming profile information.
Example 2: Type Get-OSCADUserRoamingProfile –SamAccountName “Doris”,”Katrina”command in the Windows PowerShell Console.

This command lists your specified users’ roaming profile information.
Windows PowerShell 2.0
Windows Server 2008 R2