Citrix Application list with assigned groups
<p>The following script gives me the list I want but I need to save the output to a file: </p>

<pre><code>asnp citrix*
$apps = Get-BrokerApplication -MaxRecordCount 10000 -AdminAddress  khonemdc75ddc01;
$apps | ForEach-Object { 
    $array = $_.AssociatedDesktopGroupUids
    foreach ($element in $array) {
        $policy = Get-BrokerAccessPolicyRule –DesktopGroupUid $element -AllowedConnections NotViaAG
        write-host "Application: " $_.ApplicationName 
        if ($_.AssociatedUserNames) 
        {
            write-host "Users configured  using Visibility:" $_.AssociatedUserNames
            write-host '--------------------'
        }  
        else
        { 
            write-host "Users with access inherited from DG:"
            $policy.IncludedUsers;  
            write-host '--------------------'
        }
    }
}
</code></pre>