Welcome to the Liquidware Community Site.
Current and Future Clients/Partners are Welcome.

Documenting FlexApps in all ProfileUnity Configurations

lwl_gpeck
lwl_gpeck ✭✭✭

Has your organization ran ProfileUnity with FlexApp for a while and now you might have a SMB share with a large number of FlexApps, maybe even many versions of the same application? What’s the best way to clean up this share? Without knowing which FlexApps, and the folders that contain those FlexApp Packages, are in use, you can’t safely delete the folders. Below is a ProfileUnity PowerTools Script to help with this.


Script Overview

This script recurses all ProfileUnity Configurations on a server and the FlexApp DIA modules in each configuration and documents the FlexApp DIA rules including the FlexApp Package, the Sequence number or Number in the Order column, and whether or not that rule is enabled. 


Script

<#
.SYNOPSIS
 Document all the FlexApp Packaged configured in all ProfileUnity configurations on a ProfileUnity Server. 
 Script uses the Liquidware ProfileUnity PowerTools v1.4 located at 
 https://github.com/liquidwarelabs/ProfileUnity/tree/master/PowerTools/PowerTools%20Core
 
.NOTES
 Version:       1.0
 Author:        Liquidware (Greg Peck)
 Creation Date: 3/22/2022
 Purpose/Change: Initial script development
 
 
This is not meant to be ran as a PS1, but to be ran as a copy/paste into the Powershell Window
1. Update the FQDN to the ProfileUnity Server
2. Import the Module
3. Connect to ProU
4. Update csvPath
5. Copy and run the rest of the script
 
#>
 
# ProfileUnity Server Name
$ServerName = "[FQDN_of_ProfileUnity_Server]"
 
# Import the ProU PowerTools Module
Import-Module .\ProUPowerTools.v1.4.psm1
 
# Connect to the ProfileUnity Server. Follow the Prompts
connect-ProfileUnityServer $ServerName
 
# Path to the the output file
$csvpath = "ConfiguredFlexAppPackages.csv"
 
# Get all ProfileUnity configurations on the targe server
$Configlist = get-ProUconfigs
 
# Setup a variable to store FlexApp Information
$LogData = @()
 
 
Foreach ($config in $Configlist) {
   
   # Load the ProfileUnity Configuration
   load-prouconfig $config.name
 
   # Get all FlexApp DIA's in the active configuration 
   $FlexAppDIAs = $CurrentConfig.FlexAppDias
 
   ForEach ($FlexAppDIA in $FlexAppDIAs) {
       $SequenceNumber = $FlexAppDIA.Sequence
       $FlexAppEnabled = -Not $FlexAppDIA.Disabled
   
       # Get the packages in the FlexApp DIA Rule
       $FlexAppPackages = $FlexAppDIA.FlexAppPackages.FlexAppPackage
 
       ForEach ($FlexAppPackage in $FlexAppPackages) {
 
           # Log the data to objed
           $logDataEntry = @(
               [pscustomobject]@{
                   ConfigurationName = $CurrentConfig.name
                   OrderNumber = $SequenceNumber
                   FlexAppName = $FlexAppPackage.Name
                   FlexAppPath = $FlexAppPackage.VHDPath
                   FlexAppVHD = $FlexAppPackage.VHDName
                   FlexAppEnabled = $FlexAppEnabled
                   DateCreated = $FlexAppPackage.DateCreated
                   }
           )
           
           # Add FlexApp Data to the main collection to be exported later
           $LogData += $LogDataEntry 
       }
   }
}
 
# Export the informtion to output file
$logdata | export-csv $csvpath -NoTypeInformation


This is version 1 of the script to simply export the information for your review. The next version of the script will also look at the ProfileUnity FlexApp Inventory and give you an option to remove any unused FlexApps from the inventory.