Profile Migration PowerShell Interface

In this section:

About the Profile Migration PowerShell Interface

Profile Migration can be scripted to import or export application or Application Group data between the database and the Windows profile on the client.

It is recommended that Profile Migration is configured through the Environment Manager Personalization console. The cmdlet should be used only where granular control is required to migrate individual applications or Application Groups, such as moving data from ungrouped applications to Application Groups. The cmdlet can assist with the careful migration of profile data, such as where multiple versions of Microsoft Office are used concurrently within the environment.

To migrate data from ungrouped applications to Application Groups, export the application to the local profile and then import it into an Application Group.

The PowerShell cmdlet has the following behavior:

  • It is supported only when Profile Migration is not enabled on the Personalization Server.
  • Migration occurs as many times as the cmdlet is executed. The state is not recorded and it is the responsibility of the administrator to ensure it is used only as required.
  • To ensure data integrity, the migration occurs only if there is no instance of an application running for the specified application or Application Group.
  • Errors are presented through the raising of an exception after execution.

Help

Further help is available by entering the following command:

get-help <cmdlet name>

Load the Profile Migration PowerShell Module

The module is installed in the Environment Manager Agent directory. Use the following command to load the PowerShell module:

Import-Module "C:\Program Files\AppSense\Environment Manager\Agent\EmCmdlet.dll"

If you have changed the default install location, amend the file path accordingly.

Alternatively, use the following command to load the PowerShell module from the current installation directory:

Import-Module ((Get-ItemProperty 'HKLM:\SOFTWARE\AppSense\Environment Manager').ClientPath + 'EmCmdlet.dll'

Import Profiles Using the Profile Migration PowerShell Interface

The Import-EMPManagedAppData cmdlet performs a migration of profile data from the Windows Profile into a Managed Application profile.

The Managed Application’s configured registry, folder and file inclusions and exclusions are used as the locations to import data from.

The Windows profile can be either the local profile or a roaming profile stored on a network location.

The following parameters are available:

Parameter Description
-App (Mandatory) The name of the managed application or managed Application Group against which to perform the import. This is the Display Name as seen in the Personalization Console.
-ProfilePath (Optional) The path to the Windows Profile to use as the source of the data as an alternative to importing from the local profile. This path must be a Windows Profile Version agnostic path and so should not include any version suffix such. For example, a profile path of \\server\share\user1.V2 should be entered as \\server\share\user1. Only profile versions that match the current operating system or earlier are supported. For example, it is not possible to import from a Windows 10 profile when running on a Windows 7 machine. An appropriate profile is selected at the configured location by looking for a version that matches the current operating system. If a matching profile is not found, then an earlier profile version is used. The use of Environment Variables specific to the current user session is supported.
-ProfileAppDataPath (Optional if ProfilePath is supplied) When importing from a network profile, this parameter can be used to specify the path to Roaming AppData folder when it is not part of the user’s profile location. The use of Environment Variables specific to the current user session is supported.
-Merge (Optional switch) If specified, the action merges the personalized data with the data from the Windows Profile. The personalized data takes precedence and is not replaced. If not specified, the action clears the existing profile data before the import takes place.
-Verbose (Optional switch) Provides verbose output of the PowerShell command for diagnostic purposes.

When application profiles are imported using the Import-EMPManagedAppData command, HIVE files are created in user's managed application profile and local AppSensevirtual cache. This is the behavior regardless of whether the UpgradeFBRtohive advanced setting is set to 'true' or 'false'. If set to false, managed applications continue to use the FBR method to virtualize and synchronize data. However, as HIVE files exist in user's managed application profile, data contained within the synchronized FBR file is not visible in Environment Manager Personalization Analysis. Therefore, applications do not appear to be synchronizing.

To continue using the Profile Migration PowerShell Interface, the UpgradeFBRtohive Advanced Setting must be set to 'true'.

If you do not want to continue using the HIVE files, they should be removed using the script in this Ivanti Community document: DOC-62059.

For more information about the UpgradeFBRtohive setting, see Advanced Settings.

Examples

The following shows an example of importing data from the local Windows Profile for the Managed Application Notepad:

Import-Module ((Get-ItemProperty 'HKLM:\SOFTWARE\AppSense\Environment Manager').ClientPath + 'EmCmdlet.dll')

Import-EMPManagedAppData -App Notepad

The following shows an example that could be used inside an Environment Manager Policy Custom Condition where the exit code of the script is used to determine if the condition result:

try

{

    Import-Module ((Get-ItemProperty 'HKLM:\SOFTWARE\AppSense\Environment Manager').ClientPath + 'EmCmdlet.dll')

    Import-EMPManagedAppData -App Notepad

}

catch

{

    # Exit with an error

    [System.Environment]::Exit(1)

}

Export Profiles Using the Profile Migration PowerShell Interface

The Export-EMPManagedAppData cmdlet performs a migration of profile data from a managed application or Application Group back to the Windows Profile.

The following parameters are available

Parameter Description

-App

(Mandatory)

The name of the managed application or managed Application Group against which to perform the export. This is the Display Name as seen in the Personalization Console.

-Verbose

(Optional switch)

Provides verbose output of the PowerShell command for diagnostic purposes.

Related Topics