<< Back to Script Library

FSLogix – AppMasking – Report assignments

Report user assignments for all configured AppMasking applications on this machine
Version: 2.2.6
Created: 2023-08-16
Modified: 2023-08-16
Creator: Trentent Tye
Downloads: 29
Tags: AppMasking fslogix
The Script Copy Script Copied to clipboard
<#
    .SYNOPSIS
        Reports the assigned applications to either the user or the machine

    .DESCRIPTION
        Reports the assigned applications to either the user or the machine

    .EXAMPLE
        . .\Get-FSLogixAssignedAppMaskingDetails.ps1 -username "CN=amttye,OU=Administrators,OU=Jupiter Lab Users,DC=jupiterlab,DC=com"
        Reports on which FSLogix AppMasking rules apply to this user

    .EXAMPLE
        . .\Get-FSLogixAssignedAppMaskingDetails.ps1
        Reports on which FSLogix AppMasking rules apply to which users on this machine

    .NOTES
        Returns AppMasking assigned applications for the machine or user

    .CONTEXT
        Session/Machine

    .MODIFICATION_HISTORY
        Created TTYE : 2023-08-16

    AUTHOR: Trentent Tye
#>
[CmdLetBinding()]
Param (
    [parameter(Mandatory=$false)][string]$username
)

$ProgramFiles =[Environment]::GetFolderPath([Environment+SpecialFolder]::ProgramFiles)

[string]$FSLogixRulePath = Join-Path -Path $ProgramFiles -ChildPath "FSLogix\Apps\Rules"
[string]$FRXPath = Join-Path -Path $ProgramFiles -ChildPath 'FSLogix\Apps\frx.exe'

[object[]]$FSLogixRules = Get-ChildItem -Path $FSLogixRulePath -Filter *.fxa
foreach ($rule in $FSLogixRules) {
    Write-Output "============================================================================"
    Write-Output "Rule: $($rule.fullname)"
    if ($PSBoundParameters.ContainsKey('username')) {
        & $FRXPath report-assignment -filename "$($rule.fullname)" -username "$username"
    } else {
        & $FRXPath report-assignment -filename "$($rule.fullname)" -verbose
    }
}

Write-Output "$($FSLogixRules.Count) rules found in $FSLogixRulePath"