Answered by:
Script to query if an AD user has a roaming profile configured.

Question
-
I need a script that will query all active users in a 2008r2 active directory environment and check whether or not a roaming profile was configured. I am a newbie when it comes to scripting so if there is anyone that can assist, I would appreicate it.
Thank You,
Monday, March 4, 2013 8:46 PM
Answers
-
Here is a version that retrieves all users and outputs the sAMAccountName and either True (if the profilePath starts with "\\" indicating a unc path) or False (if profilePath has no value is a local path). This is one line:
Get-ADUser -Filter * -Properties profilePath | Select sAMAccountName, @{Name="Roaming Profile"; Expression={$_.profilePath -Like "`\`\*"}}
-----
Richard Mueller - MVP Directory Services
- Marked as answer by Eddie Sardinha Tuesday, March 5, 2013 11:20 PM
Tuesday, March 5, 2013 3:51 PM
All replies
-
Retrieve all users that have a value assigned to the profilePath attribute. For example:
Get-ADUser -filter {profilePath -Like "*"} -Properties profilePath
-----
Richard Mueller - MVP Directory Services
- Proposed as answer by Kazun Tuesday, March 5, 2013 5:01 AM
Tuesday, March 5, 2013 2:24 AM -
Thank you, but being a newbie does {profilePath -Like "*"} mean I have to enter what the users profile path is?Tuesday, March 5, 2013 1:54 PM
-
No, the filter retrieves all users that have any value assigned to the profilePath attribute. The "*" is the wildcard character. To retrieve all users with no value assigned, use {profilePath -NotLike "*"}.
Richard Mueller - MVP Directory Services
Tuesday, March 5, 2013 3:22 PM -
Great! That worked! One last question, how would I pipe that output to an excel file formatted?Tuesday, March 5, 2013 3:36 PM
-
Here is a version that retrieves all users and outputs the sAMAccountName and either True (if the profilePath starts with "\\" indicating a unc path) or False (if profilePath has no value is a local path). This is one line:
Get-ADUser -Filter * -Properties profilePath | Select sAMAccountName, @{Name="Roaming Profile"; Expression={$_.profilePath -Like "`\`\*"}}
-----
Richard Mueller - MVP Directory Services
- Marked as answer by Eddie Sardinha Tuesday, March 5, 2013 11:20 PM
Tuesday, March 5, 2013 3:51 PM -
Thank You!Tuesday, March 5, 2013 11:24 PM