Powershell Module for Citrix WEM – Part 2 – GPO Import and more


Update:
Part 3 was posted, featuring Environmental Settings, Microsoft USV Settings, and more:
https://msfreaks.wordpress.com/2018/01/08/powershell-module-for-citrix-wem-part-3-environmentalsettings-and-microsoftusvsettings-from-gpo-and-much-much-more/

A few weeks ago I started work on a Powershell Module for Citrix WEM to make my life as an admin / consultant less boring. Adding Actions can be a tiresome and repetitive job.

Thank you for all the reactions to this first public release of the module.

More info on the first release can be found here.

The only function that was available then was a function to create Application Actions from the default Start Menu folders or files in a user specified path.

Today I bring you a major update to the module, bringing it to version 0.9.4 for now. Sorry for the lengthy post.

Functions updated:
New-VUEMApplicationsXML
This function will now detect and scan a redirected Start Menu folder if the function is executed in a user context that has a redirected Start Menu.
The function now accepts a Prefix parameter which you can use to add in front of the Action Names in the WEM Console, and a SelfHealingEnabled switch, which sets the SelfHealingEnabled check if you supply this parameter.

New functions added:
New-VUEMNetDrivesXML
You can use this function to export all Mapped Network Drives or a specific Mapped Network Drive from the current user context to a WEM compatible XML file (VUEMNetDrives.xml) which you can then import using the WEM Console.

New-VUEMUserDSNsXML
You can use this function to export all User DSNs, all System DSNs or a specific User or System DSN from the current user context to a WEM compatible XML file (VUEMUserDSNs.xml) which you can then import using the WEM Console.

 

The aforementioned three functions can all be run from within a user’s session, ensuring a mimicked user experience in WEM, at least where these three types of Actions are concerned.

I added another function in this version of the module, and it’s a big one.

Import-VUEMActionsFromGPO
This function scans GPO Backup files for the following User Preferences (Computer Preferences are ignored for now!) and converts them to WEM Action XML files:

GPO Drive Mappings User Preferences
If any Drive Mappings are found they will be converted to WEM Actions and written to VUEMNetDrives.xml.
If the GPO for a drive mapping has the action set to D (Delete), the drive mapping preference will be skipped.
The Action Name will be based on the preference name and its label, if it exists.
If the preference has the RunOne switch enabled, the SelfHealing switch will be disabled.
If the preference has the RunOne switch disabled, the SelfHealing switch will be enabled.
Credentials are skipped.

GPO Environment Variables User Preferences
If any Environment Variables are found they will be converted to WEM Actions and written to VUEMEnvVariables.xml.
Both System and User variables from the User GPO will be processed.

GPO Files and GPO Folders User Preferences
If any File or Folder actions are found they will be converted to WEM Actions and written to VUEMFileSystemOps.xml.
Since WEM doesn’t differentiate between files and folders where Actions are concerned, both preferences are processed into the same array of actions.
If the GPO for a file or folder action has the action set to D (Delete), the Action Name is suffixed with ” (Delete)”.
For file creation Actions the ActionType is set to 0.
For folder creation Actions the ActionType is set to 5.
For file or folder deletion Actions the ActionType is set to 1.

GPO IniFiles User Preferences
If any IniFile actions are found they will be converted to WEM Actions and written to VUEMIniFileOps.xml.
IniFile User GPO Preferences are processed as is.

GPO Printer Mappings User Preferences
If any Printer Mapping preferences are found they will be converted to WEM Actions and written to VUEMPrinters.xml.
If the GPO for a printer mapping has the action set to D (Delete), the printer mapping preference will be skipped.
The Action Name will be based on the preference name and its label, if it exists.
If the preference has the RunOne switch enabled, the SelfHealing switch will be disabled.
If the preference has the RunOne switch disabled, the SelfHealing switch will be enabled.
Printer Mappings are created as Map Network Printer Actions.
Only Printer Mappings from the GPO User Preferences are processed. If you published printers to the GPO, these will be skipped.
Credentials are skipped.

GPO Registry Settings User Preferences
If any Registry preferences are found they will be converted to WEM Actions and written to VUEMRegValues.xml.
If the GPO for a Registry preference has the action set to D (Delete), the Action Name is suffixed with ” (Delete)”.
Registry preference Collections are processed as individual actions, Collection names are omitted.

GPO DataSources User Preferences
If any DataSources preferences are found they will be converted to WEM Actions and written to VUEMUserDSNs.xml.
DataSources are processed into UserDSN actions.
System DSN preferences will be skipped.
Seems WEM only supports UserDSN based on the “SQL Server” driver, so all DataSources based on other drivers are skipped.
Credentials are skipped.

The rest of this post shows some basic usage of the new function Import-VUEMActionsFromGPO.

I have two Group Policy Objects set up. One contains User Preferences (Windows Settings) and the other contains User Preferences (Control Panel Settings).

importgpo-01importgpo-02importgpo-03importgpo-04importgpo-05importgpo-06importgpo-07importgpo-08

I have created backups of these two GPOs (Right-click on the GPO, choose Backup, and point to a folder).

importgpo-09

Running the command “Import-VUEMActionsFromGPO -GPOBackupPath c:\temp\gpobackup -OutputPath c:\temp”:


I can now copy over all the xml files that were just generated to a machine that has the WEM Console installed and is connected.
Importing the xml files into WEM:

 

Until next time,

 

Arjan Mensch

Advertisements

20+ years experience in Microsoft powered environments. Enjoy automating stuff using scripts, powershell, and even batch files. In my free time (hah! as if there is any) I hunt achievements and gamerscore on anything Xbox Live enabled (Windows Mobile, Windows 8, Windows 10, Xbox 360 and Xbox One). When I'm not doing that I enjoy traveling or riding my Yamaha R1 on the edge ;)

Tagged with: , ,
Posted in Citrix, Powershell
3 comments on “Powershell Module for Citrix WEM – Part 2 – GPO Import and more
  1. Ray says:

    Very Nice. Wonderful job.

  2. Jay Kociol says:

    I am getting the error, can you tell me why?

    Import-VUEMActionsFromGpo : You cannot call a method on a null-valued expression.
    At line:1 char:1
    + Import-VUEMActionsFromGpo -GPOBackupPath ‘C:\Install\GPO Export XML\C …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : InvalidOperation: (:) [Import-VUEMActionsFromGpo], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull,Import-VUEMActionsFromGpo

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s

Blog Authors
https://paypal.me/ArjanMensch
BTC:1AiAL6QDbfNPiduYYEoy3iNS2m6UKJW2He
LTC:Lf52uAJiCRQtiegJyKqVvoh4FuvwMkHPae
ETH:0x096a12424e991696ad21cfc0e0f3749ab4f8ce1b
DSH:XnRGpf2v36F5iDT5uFaq7DsHPFF435EPmT
XMR:49UCmvAYNxB3voEVbfL8KDENwcg9SE9PeY5jU8YCaHMuLXHapRmfhgHWbwaVe4vUMveKAzAiA4j8xgUi29TpKXpm3xumqCq

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 400 other followers

Blog Stats
  • 2,725,093 hits
  • An error has occurred; the feed is probably down. Try again later.
%d bloggers like this: