Citrix Virtual Apps and Desktops SDK

Get-UserProfilePath

Gets the path (or paths) at which an individual user’s profile is stored.

Syntax

Get-UserProfilePath
   -User <String>
   -PathToUserStore <String>
   [<CommonParameters>]
<!--NeedCopy-->

Description

Use this cmdlet to search for specific user profile folders, based on a configured store path.

The cmdlet will perform automatic substitutions on all of the dynamic parts of the store path. These substitutions will be made based either on the details of the individual user given, or by enumerating all possible strings that are permitted by the variable in question. The approach taken depends on the variable. User-specific variables such as %USERNAME% will be substituted based on the user. Variables such as !CTX_OSNAME! will be substituted by enumerating the possibilities.

Once all substitutions have been made, the cmdlet will search the user store for any directories that exist, matching the substituted path. All such directories are then reported as outputs of the cmdlet.

Once this cmdlet has been used to locate the profile store, other Windows PowerShell scripts can be written to inspect or manipulate the contents of the profile, provided that such access is allowed by the permissions of the profile store.

Examples

EXAMPLE 1

This command attempts to locate the user profile folder for the user account Fred within the domain FABRIKAM, where the user has been specified as an NT account name. This user’s details will be substituted into the profile store path. A likely return result would be \\server\Profiles$\Fred.FABRIKAM.

Get-UserProfilePath -PathToUserStore \\server\Profiles$\%USERNAME%.%USERDOMAIN% -User FABRIKAM\Fred
<!--NeedCopy-->

EXAMPLE 2

This command attempts to locate the user profile folder for the user account Fred within the domain FABRIKAM, where the user has been specified as a User Principal Name (UPN). This user’s details will be substituted into the profile store path. Possible return results might be \\server\Profiles$\Fred.FABRIKAM\Win7 or \\server\Profiles$\Fred.FABRIKAM\WinXP.

Get-UserProfilePath -PathToUserStore \\server\Profiles$\%USERNAME%.%USERDOMAIN%\!CTX_OSNAME! -User Fred@FABRIKAM
<!--NeedCopy-->

EXAMPLE 3

This command attempts to locate the user profile folder for the user account whose Security Identifier (SID) has been specified. This user’s details will be substituted into the profile store path. Possible return results might be \\server\Profiles$\Fred.FABRIKAM\x86 or \\server\Profiles$\Fred.FABRIKAM\x64.

Get-UserProfilePath -PathToUserStore \\server\Profiles$\%USERNAME%.%USERDOMAIN%\!CTX_OSBITNESS! -User S-1-5-32-1045337234-12924708993-5683276719-19000
<!--NeedCopy-->

Parameters

-User

Specifies the user whose profile is to be found within the store. Users can be identified in terms of their account name, UPN or SID.

Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: True (ByValue)
Accept wildcard characters: True

-PathToUserStore

Specifies the UNC path to the configured profile store.

Type: String
Position: Named
Default value: None
Required: True
Accept pipeline input: False
Accept wildcard characters: True

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Inputs

String

The pipeline accepts any valid User parameter, as an account name, UPN or SID.

Outputs

String

The UNC path to the profile folder(s) belonging to the specified user. Each reported path will denote a directory that exists within the store, and will have all of its dynamic elements substituted with static strings.

Get-UserProfilePath