One of the biggest issues (complaints) about earlier versions of XenDesktop 7.x was that you had to present desktops to all users of a delivery group. The truth to this is that you can actually limit this - however it is not part of the GUI until the latest releases of the 7.x platform.
If you are in need of limiting who gets desktops, you need to break out your PowerShell SDK for XenDesktop and look at the Entitlement Policy for your Delivery Group. You can enable the User Filter and in turn assign users or groups to get the desktop.
Below is a sample of this change. Note that you have to have a Delivery Group with Desktops enabled for this to work.
Add-PSSnapin *Cit*
Get-BrokerDesktopGroup *
#Note the Uid of the Delivery Group you are interested in limiting - in this case my sample Uid is 32
Get-BrokerEntitlementPolicyRule -Uid 32 | Set-BrokerEntitlementPolicyRule -IncludedUserFilterEnabled $true -IncludedUsers "MyDomain\MyUserGroup"
#The above will set the entitlement policy object to be enabled and add my limiting group
Get-BrokerEntitlementPolicyRule -Uid 32
#Verify the settings you just configured
Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts
Saturday, August 13, 2016
Thursday, August 4, 2016
Pesky Icon Data
I ran into an issue with a Citrix XenDesktop environment where application settings had to be recovered but unfortunately none of the Encoded Icon Data was available so all applications had the default citrix application icon with Uid of 1.

I had to get a little creative with PowerShell to get the application's icon data back. Unfortunately if there were custom icons, this wouldn't work - but in a time of recovery beggars can't be choosers.
The below script will take each application located on a server from a delivery group (I only had one here, but this could be upgraded to walk multiple) and extract the first available icon from the executable of the published application, create the encoded icon data, and then assign the application to that new icon. In my case this took care of most of the applications. I had a couple published batch files that I tweaked after the fact - but this was much nicer than going through the GUI and manually adjusting every application in the environment.
Add-PSSnapin *Cit*
$applications = $null
$applications = Get-BrokerApplication * | Where-Object {$_.IconUid -eq 1}
$sessionhost = $null
$sessionhost = Get-BrokerDesktop * | where-object {$_.MachineUid -eq 1}
$manuallyfix = $null
foreach($app in $applications){
if($app.CommandLineExecutable -like "C:*")
{
$localpath=$null
$localpath=$app.CommandLineExecutable.TrimStart("C",":")
$path = $null
$path = "\\"+$sessionhost.HostedMachineName+"\C$"+$localpath
$icon = $null
$icon =get-ctxicon $path -index 0
$newicon = new-brokericon -EncodedIconData $icon.EncodedIconData
write-host $app.browsername "changing to Icon Uid: " $newicon.uid
Get-BrokerApplication $app.browsername | Set-BrokerApplication -IconUid $newicon.uid
}else
{$manuallyfix+=$app.name+"`n"}
}
write-host "`n`nManually fix these apps: `n"
$manuallyfix

I had to get a little creative with PowerShell to get the application's icon data back. Unfortunately if there were custom icons, this wouldn't work - but in a time of recovery beggars can't be choosers.
The below script will take each application located on a server from a delivery group (I only had one here, but this could be upgraded to walk multiple) and extract the first available icon from the executable of the published application, create the encoded icon data, and then assign the application to that new icon. In my case this took care of most of the applications. I had a couple published batch files that I tweaked after the fact - but this was much nicer than going through the GUI and manually adjusting every application in the environment.
Add-PSSnapin *Cit*
$applications = $null
$applications = Get-BrokerApplication * | Where-Object {$_.IconUid -eq 1}
$sessionhost = $null
$sessionhost = Get-BrokerDesktop * | where-object {$_.MachineUid -eq 1}
$manuallyfix = $null
foreach($app in $applications){
if($app.CommandLineExecutable -like "C:*")
{
$localpath=$null
$localpath=$app.CommandLineExecutable.TrimStart("C",":")
$path = $null
$path = "\\"+$sessionhost.HostedMachineName+"\C$"+$localpath
$icon = $null
$icon =get-ctxicon $path -index 0
$newicon = new-brokericon -EncodedIconData $icon.EncodedIconData
write-host $app.browsername "changing to Icon Uid: " $newicon.uid
Get-BrokerApplication $app.browsername | Set-BrokerApplication -IconUid $newicon.uid
}else
{$manuallyfix+=$app.name+"`n"}
}
write-host "`n`nManually fix these apps: `n"
$manuallyfix
Monday, December 1, 2014
File Selection Input Window
Sometimes in my scripting ways I need to solicit a location from a user with for reading or writing data. Below is a simple function I have used when I need a user to select a Comma Separated Values file. It creates a simple dialogue box showing .CSV files in a particular location. It will either return the selected file name or an error. It is a simple starting point that can be expanded upon as needed.
Function Select-FileWindow
{
param(
[string]$Title = "Select CSV",
[string]$Directory = "C:",
[string]$Filter = "CSV Files (*.csv)|*.csv"
)
[System.Reflection.Assembly]:: LoadWithPartialName("System. Windows.Forms") | Out-Null
$objForm = New-Object System.Windows.Forms. OpenFileDialog
$objForm.InitialDirectory = $Directory
$objForm.Filter = $Filter
$objForm.Title = $Title
$objForm.ShowHelp = $true
$Show = $objForm.ShowDialog()
If ($Show -eq "OK")
{
Return $objForm.FileName
}
Else
{
Write-Error "Operation cancelled by user."
}
}
Friday, November 28, 2014
Documenting XenApp 6.5 Environments
Frequently I need to document XenApp environments either for build documents or for health check purposes. While I have a small arsenial of scripts I have written to acomplish several aspects of these documentation encounters, I recently came across Carl Webster's documentation script. I have to say I was impressed with the thoroughness of the script. I recommend anyone check this out if you need to quickly document a XenApp 6.5 environment.
Carl Webster's XenApp Documentation
Carl Webster's XenApp Documentation
Subscribe to:
Posts (Atom)