Users are unable to logon to their Citrix XenDesktop 5 desktops, and the following error is seen in the Windows Application log on the XenDesktop 5 Controller:
“Event 1163, Citrix Broker Service : No connection license available. To resolve, free licenses by closing sessions that are not needed, or add more licenses.”
Solution to free one license at a time:
i: Logon to the Citrix Licensing server and open up a command prompt.
ii: Run the command below to 'list all licensed users and devices organized by feature and version':
udadmin -list -a
iii: Then run either the first command below to 'delete a licensed user from the feature specified' or the second command below to 'delete a licensed device from the feature specified' (Note that … -device … -delete did not work until Citrix License Server Version 11.9 Build #11011.)
udadmin -f featurename -user username -delete
udadmin -f featurename -device devicename -delete
Solution to free multiple licenses at a time:
i: From a command prompt run the command
udadmin -list -a > users.txt
ii: Edit the users.txt file to contain just the user strings (users or devices) as desired (don't worry about preceding spaces,) remembering to note the feature name from the output.
iii: (If required) Edit strFeature string in udadmindelete.vbs script if different from XDT_ENT_UD.
iv: (If required) Change strUserDev string in udadmindelete.vbs script from user to device if running against a list of devices.
v: Double-click on the udadmindelete.vbs script to run (the users.txt file needs to be in the same location as the udadmindelete.vbs script.)
And we're done!
Copy all the contents below into a text document and save as udadmindelete.vbs.
Remember to change the string contents for strFeature and strUserDev (user or device) as per requirements.
Apologies if this is not the most elegant script, was a mash up of bits and pieces from around the net!
Dim objFSO, strTextFile, strData, strLine, arrLines, objShell, strTmp, strFeature, strUserDev
CONST ForReading = 1
set objShell = wscript.createObject("wscript.shell")
'Name of the text file to be read
strTextFile = "users.txt"
'ADJUST strFeature AS PER REQUIREMENTS
strFeature = "XDT_ENT_UD"
'ADJUST strUserDev AS PER REQUIREMENTS
strUserDev = "user"
'Create a File System Object
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Open the text file - strData now contains the whole file
strData = objFSO.OpenTextFile(strTextFile,ForReading).ReadAll
'Split the text file into lines
arrLines = Split(strData,vbCrLf)
'Step through the lines
For Each strLine in arrLines
strTmp = "udadmin -f " & strFeature & " -" & strUserDev & " " & strLine & " -delete"
'To see the command being, run add a line below with wscript.echo strtmp
Set objFSO = Nothing