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

ProfileUnity Scripting: Reporting AD Groups Controlling Access to FlexApps

lwl_gpecklwl_gpeck ✭✭✭
Request

I recently had a customer ask for an easy way to give the CMDB folks a list of FlexApps and he Active Directory group that gave access to each application. The customer’s environment is a large non-persistent virtual desktop environment utilizing ProfileUnity with ProfileDisk and FlexApp. 


Solution

Utilizing the Liquidware ProfileUnity PowerTools we were able to provide the CMDB team the list of apps and associated users desired. This list will be used to document who has access to a software and might be useful with licensing purchases. 


  • Download the Powertools. These can be found on Github (here). This script was written using PowerTools v1.2.
  • Save the ProUPowerToolsv1.2psm1 to a folder (C:\ProUPowerTools)
  • Download the script attached below and save to the C:\ProUPowerTools (or other folder)
  • Open a PowerShell command prompt with Admin privileges.
  • Change directories to C:\ProUPowerTools (cd \ProUPowerTools)
  • Import the PowerTools Module (import-module .\ProUPowerTools.v1.2.psm1)
  • Connect to the ProfileUnity Console (Connect-ProfileUnityServer) and follow the prompts
  • Copy the following script to the console. The script ONLY reads configurations it does not make any changes. 


# Path to the the output file
$csvpath = "c:\temp\test.csv"

# Get all ProfileUnity configurations on the targe server
$Configlist = get-ProUconfigs

# Set LogDat Variable
$LogData = @()

foreach ($config in $Configlist)
{
  # Load the active configuration
	load-prouconfig $config.name
	
	# Get all DIA configs in the active configuration that are not disabled
	$DIAConfigs = $CurrentConfig.FlexAppDias | Where-Object {$_.Disabled -eq $False}
	
	# Create a collection of FlexApp package names
	$FlexApps = @($DIAConfigs.FlexAppPackages.FlexAppPackage.name | select-object -unique)
	
	foreach ($FlexApp in $FlexApps)
	{
		# Get the Filter for the FlexApp Configuration
		$DiaFilters = @($DIAConfigs | Where-Object {$_.flexapppackages.flexapppackage.name -eq $FlexApp} | foreach {$_.filter.name})
		
		ForEach ($Filter in $DiaFilters) {
			# Get ProfileUnity Filter Information
			Load-ProUFilter -name $Filter
				
			# Log the data to objed
			$logDataEntry = @(
				[pscustomobject]@{
					ConfigurationName = $CurrentConfig.name
					Filters = $currentfilter.Name
					ADGroup = $currentfilter.FilterRules.Value
					Flexapps = $FlexApp
					}
				)
			# Add FlexApp Data to the main collection to be exported later
			$LogData += $LogDataEntry
		}
	}
}

# Export the informtion to output file
$logdata | export-csv $csvpath -NoTypeInformation


The Details

The script connects to the ProfileUnity console and gathers all of the configurations. One be one, the configurations are loaded and FlexApp DIA configurations read. For each FlexApp DIA the Filter information is exported to a csv file with the configuration name, the Filter Name, the Active Directory group name, and the FlexApp Name.


Resulting CSV File Example


Files

Download the ProfileUnity Power Tools from Github (here).


The above file can be used to copy and paste command into the PowerShell Console.


Note: Liquidware Labs, Inc. is not responsible for the outcome of the script. The script is being provided as a guidance. Caution should be used before using any script available on the Internet.

Sign In or Register to comment.