Unexpected results when using %USERPROFILE% variable in bundle Uninstall

  • 7013455
  • 15-Oct-2013
  • 15-Oct-2013

Environment

Novell ZENworks Configuration Management 11.2 Bundles

Situation

A File Removal bundle action in the Uninstall tab removes files based on the %USERPROFILE% system variable
The File Removal action is set to Run Action As: User
The bundle is set to uninstall when it is blocked. This setting is in ZCC > Bundles > [bundle] > Actions > Uninstall > Options > Blocked Assignment Options > Uninstall application
The bundle assignment is blocked in ZCC > Device > [device] > Relationships > [select a bundle] > Block

When the Uninstall runs based on a bundle Block, it runs in a system context despite the Run Action As: User setting.
The %USERPROFILE% variable gets resolved to the SYSTEM user path instead of the logged in user path.

The following message is seen in the zmd-messages.log:

 [DEBUG] [10/02/2013 14:35:45.317] [5116] [fileremovalaction] [1] [user] [File Removal Action] [] [The file/directory 'C:\Windows\system32\config\systemprofile\<file-name>' does not exist.] [] []

Resolution

Option A:
Use a Run Script bundle action with a script to clean up the files from all user profiles

Option B:
Install and uninstall the files to and from the All Users profile

Additional Information

This is working as expected because the uninstall is triggered by the bundle block. This means that there may not even be a user logged into the device at the time the uninstall runs. Also, if the bundle Install uses the %USERPROFILE% variable as well, the uninstall would have to clean the files from all profiles in order to completely clean it up.