[UPDATED]Automatically create LiquidWare ProfileUnity Filters with OU and Security Group Conditions with PowerShell

When using LiquidWare ProfileUnity you can use filters to create context. By using context, you create a workspace environment that follows the user, making sure he or she will (always) receive all the right resources, like shortcuts, printers, drive mappings etc. never mind their location or the device they are using. But what if you already have Security Groups and Organisational Unit’s (OU) in your Active Directory and want to create context aware filters based on that? Of course, you can do this by hand: create a new filter and select your User Group Membership or Organisational Unit condition of choice – a good option for smaller to mid-sized organisations. However, my motto is; Automate Everything!

[UPDATE] Since this blog was released LiquidWare added the ability to import CSV files directly into ProfileUnity Filters from PowerShell. (Thanks to Jack Smith). You can find these scripts and tools under the PowerTools section in the LiquidWare Labs GitHub.  With these tools in hand I have rewritten my scripts to now 100% automated the creation of filters for Organisational Units and Security Groups. The script will now read the security Groups or Organisational Unites from a Base OU and add these to a CSV file and then import the CSV into ProfileUnity. You can still find the old script below the new ones.

New Security Group Filters Script:


New Organisational Unit Filters Script:

[OLD WAY]I created a PowerShell script that will read all Security Groups in a Organisational Unit (Base OU) and create JSON files for each Security Group. These JSON files contain the necessary information to create a context aware filter based on the Security Groups in LiquidWare ProfileUnity. I also made the same script for User Organisational Units’s. At this moment it’s not possible to import Filter JSON files directly into LiquidWare ProfileUnity with PowerShell. But there are other commands you can do with PowerShell and ProfileUnity see the PowerTools here. If importing Profile JSON files function becomes available I will edit these scripts.
For now, follow the step below to import the JSON files:

Step1: Click on Filter Management in the ProfileUnity Administration console.

Step2: Then on the top right side click on Import.

Step3: Select the JSON file and click open. You will then see a successful imported screen.

Here is the script to create the JSON files from Security Groups. Change the Base Organisational Unit variable to your desired Organisational Unit and the working directory to the output directory of your choose. This is where the JSON files will be created.
The result of the script:

Here is the script to create the JSON files from OU’s.

I hope this was informative. For questions or comments you can always give a reaction in the comment section or contact me: