Profile management provides run time information in the form of WMI objects. This includes the profile provider, profile type, size, disk usage, product details, timestamps of different triggers occurred during logon and logoff, current configuration, etc. These WMI objects are consumed and displayed in the Director console as session information.
This article describes in detail the WMI objects and how to query them using PowerShell.
Note: Profile management WMI objects are available only on XenDesktop deployment starting from version 7.0
What this article covers?
This article covers all WMI objects related to runtime metrics that are published by Profile management for every session. This article also includes some basic examples of how to query the WMI objects using PowerShell.
This article does not cover any details of WMI itself. See the following article for more information on WMI:
http://msdn.microsoft.com/en-us/library/aa394582(v=vs.85).aspx
When should I use these WMI objects?
Runtime information about the profiles can help answer the following questions:-
- Which technology is managing a profile? Is it a Microsoft roaming profile or a Citrix profile?
- What kind of profile is loaded? Is it a local profile, a template profile, or some other profile type?
- What the disk size is allocated to my profile on the network drive? How much my profile is using? How many files are in my profile?
- What is the time taken for various profile management triggers during logon and logoff? My system is slow – is it due to profile load?
- Can I generate the disk diagnostic information for my profile store at this point in time
Most of this information can be obtained only from Director, a XenDesktop console. The same information is available on every endpoint in the form ofWMIobjects which can be queried or even automated if required.
Profile management WMI Object model
The Profile management solution provides the following WMI classes for different purposes. All these WMI classes can be queried using programmatic interfaces, the command line, and PowerShell. All the Profile management WMI classes are registered under the “Root\Citrix\profiles\metrics” namespace.
The following image shows the types and methods available in every WMI class for programmatic access using WMI APIs.
Common SessionId field
The SessionId field of type string is available in every class to handle multiple sessions to hosted server. There can be several instances of WMI objects of the same class which has unique session key value in the SessionId field which provides 1-1 mapping to the respective session in the system. The SessionId field will be used to identify the session and thereby the user.
The PowerShell Examples section shows how to use this SessionId field in PowerShell to list the objects for a specific session and for the current session.
Session
Provides details on profile related information for the session. This object can be used to query disk usage data for the profile store and also for the redirected folder path.
ProfileProvider (integer)
Indicates who’s handling the profile
Value | Meaning |
0 | Profile managed by Citrix Profile management |
1 | Microsoft Roaming profile |
2 | Others |
ProfileType (integer)
Indicates the profile type
Value | Meaning |
0 | Managed profile by one of the provider listed in the ProfileProvider filed |
1 | Temporary profile |
2 | Mandatory profile which clears all user specific profile data for this session during logoff |
3 | Roaming profile |
4 | Unknown type |
ProfileFolderCount (integer)
Number of folders in the profile
ProfileFileCount (integer)
Number of files in the profile
ProfileSize(Integer)
Total size of the profile folder for the user
Void RunHealthCheck()
Method or a WMI Task that can be called on every Session WMI object to get disk related data. This method creates array of Diagnostic objects (one per network location) if not present for the session or it updates the existing Diagnostic objects with the newly calculated value. The network location here refers to the profile store location or different location where the each special folder is redirected.
Diagnostics
Contains disk related information for profile storage and folder redirection including the network path.
There can be multiple objects of this type for each to profile store location or the root profile folder and also for each redirected folders on the network, such as “Documents”.
FolderName(String)
Name of the redirected special folder or the name of the profile store folder in the profile store path
FolderGuid(String)
GUID for the network path, which can be used to uniquely identify folder if folder names are localized
SmbPath(String)
Path to the actual network location
NetworkLatency(Integer)
Indicates if profile management is online or offline
Value | Meaning |
-1 | Offline, no network connection and no active sync enabled |
1 | Online |
DiskQuota(Integer)
Total allocated size for the network location for the user associated with the session
DiskUsage(Integer)
Total bytes consumed by the user of this session.
LogonTimings
Provides timestamps of various Profile management triggers that occurred during the logon process.
The timestamps here can be used to calculate the time period of different tasks that are carried out along with the logon process.
FieldId | Description | Notes |
DesktopReady | Time at which the desktop became available to the user | The duration between the logon process start time and DesktopReady time gives the overall logon duration for this session. |
ProfileLoadStart | Time at which the profile started to load | The difference between these gives the profile load time for the given session. |
ProfileLoaded | Time at which the profile finished loading | |
GroupPolicyStart | Time at which Group Policy processing started | The difference between these gives the group policy processing time for the given session. |
GroupPolicyComplete | Time at which Group Policy processing finished time | |
LogonScriptStart | Start time of the start-up logon | Both together give the logon script execution duration which is displayed in the Director console. |
LogOnScriptComplete | Time at which Start-up script is completed |
LogoffTimings
Provides timestamps of various Profile management triggers that occurred during the previous logoff process.
The timestamps here can be used to calculate the time span for different tasks that are carried out along with the logon process.
FieldId | Description | Notes |
LogoffStart | Logoff process start time | The difference between these provides the logoff processing duration. |
LogoffCompleted | Time at which logoff process finished | |
RegistryProcessingStart | Registry processing start time | The difference between these provides the registry processing duration.Registry values for the current user are processed and saved to the profile store. |
RegistryProcessionComplete | Registry processing finish time | |
FileSystemProcessingStart | File synchronization and related file system processing start time | The difference between these provides the logon script execution duration, which is displayed in Director. |
FileSystemProcessingComplete | File synchronization and related file system processing finish time | |
CPSProcessingStart | Cross-platform settings processing start time | The difference between these provides cross platform setting processing duration |
CPSProcessingComplete | Cross-platform settings processing finish time |
Product
Retrieves the Profile management version from the string in the Version field, and the whether the Profile management is enabled or not from the Enabled field.
Configuration
Provides methods to obtain the configuration for the current session.
string GetConfiguration( string section, string key)
string GetEffectiveConfiguration( string section, string key )
The above methods lists each of the policy item that Profile management supports and its corresponding value for the given session
PowerShell Example
1. The profile management WMI classes can be listed using following command in PowerShell
Get-WmiObject -namespace “root\citrix\profiles\metrics” -List | where {$_.name -notlike ‘*_*’}
2. Command to list any of the profile management WMI object in a client OS machine where these can only one active session.
Note: Replace “Session” with the intended class name.
PS>Get-WmiObject -namespace “root\citrix\profiles\metrics” –Class Session
3. Command to list any of the profile management WMI objects for a specific session
Note: <<Session Id>> should be replaced with a valid session id. Also replace “Session” with the intended class name.
Get-WmiObject -namespace “root\citrix\profiles\metrics” –Class Session | where {$_.SessionId –eq <<Session Id>>}
4. To list all the profile management WMI object for all the sessions
PS C:\>$classList = Get-WmiObject -namespace “root\citrix\profiles\metrics” -List | where {$_.name -notlike ‘*_*’} | select-object name
PS C:\>foreach ($class in $classList) { gwmi -namespace “root\citrix\profiles\metrics” -class $class.Name }
5. To list all the profile management WMI object for the current session
PS C:\> $classList = Get-WmiObject -namespace “root\citrix\profiles\metrics” -List | where {$_.name -notlike ‘*_*’} | select-object name
PS C:\> $sid = Get-WmiObject -namespace “root\citrix\profiles\metrics” -class Configuration | select-object SessionId
PS C:\> foreach ($class in $classList) { gwmi -namespace “root\citrix\profiles\metrics” -class $class.Name | where {$_.SessionId -eq $sid.SessionId }}
6. To list all the profile management WMI object for a specific session in a server machine
Note: <<Session Id>> should be replaced with a valid session id
PS C:\> $classList = Get-WmiObject -namespace –“root\citrix\profiles\metrics” -List | where {$_.name -notlike ‘*_*’} | select-object name
PS C:\>foreach ($class in $classList) { gwmi -namespace “root\citrix\profiles\metrics” -class $class.Name | where {$_.SessionId -eq <<Session Id>>}}
7. To list all the WMI objects in table format
PS C:\> $classList = Get-WmiObject -namespace “root\citrix\profiles\metrics” -List | where {$_.name -notlike ‘*_*’} | select-object name
PS C:\> foreach ($class in $classList) { gwmi -namespace “root\citrix\profiles\metrics” -class $class.Name |select * -exclude “_*”, OPtions,ClassPath, Properties, SystemProperties,Qualifiers,Site,Container | format-table }
8. To list disk diagnostic information for a specific session
PS C:\>$ProfileSession = Get-WmiObject -namespace “root\citrix\profiles\metrics” –Class Session | where {$_.SessionId –eq <<Session Id>>}
PS C:\> $ProfileSession.RunHealthChech()
PS C:\> Get-WmiObject -namespace “root\citrix\profiles\metrics” –Class Diagnostics | where {$_.SessionId –eq <<Session Id>>}
Note: “|where {$_.SessionId –eq <<Session Id>>}” can be ignored in all the above examples in case of non-server machines where always only one session exists.