Skip to content
Skip to content
Gooseleggs Site

Ramblings

← SCOM 2012 SP1 Error when displaying dashboards
Jakes new sandpit →
-->

Powershell script to get users profile path (RDS and Roaming)

Posted on April 17, 2013 by admin

Copy and paste the following into a powershell script.  Be sure to run this on a 2008R2 DC or equiv, or else the RDS profile is not available

Import-Module ActiveDirectory
Get-ChildItem -Filter “(&(objectclass=user)(objectcategory=user))” -Path ad:\”CN=Users,DC=horodc,DC=local” -Recurse |
foreach {
$user = [adsi]”LDAP://$($_.DistinguishedName)”
$user | select @{N=”Name”; E={$_.name}},
@{N=”ProfilePath”; E={$_.profilepath}},
@{N=”RDSProfilePath”; E={$_.psbase.invokeget(“TerminalServicesProfilePath”)}}
} | export-csv c:\test.csv

This entry was posted in Uncategorized. Bookmark the <a href="https://www.thesmithcave.nz/?p=143" title="Permalink to Powershell script to get users profile path (RDS and Roaming)" rel="bookmark">permalink</a>.
← SCOM 2012 SP1 Error when displaying dashboards
Jakes new sandpit →

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

© 2025 | Blog info WordPress Theme | By Bharat Kambariya