henrydenhengst

Basic XenDesktop 7 commands

May 26th, 2015
920
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Add-PSSnapin Citrix*
  2. #
  3. # How to check installed XenDesktop version ?
  4. Get-BrokerController
  5. Get-BrokerController  |select DNSName, ControllerVersion
  6. #
  7. # How to display XenDesktop site configuration ?
  8. Get-XDSite
  9. # or
  10. Get-ConfigSite
  11. #
  12. # How to add/remove delivery controller ?
  13. # XenDesktop 7.6 install with powershell Part 1 - Figure 14
  14. # -AdminAddress - controller we will connect to
  15. # -ControllerName - controller we will add/remove
  16. #
  17. # Add new controller to the site
  18. Add-XDController -AdminAddress XD001 -ControllerName XD002
  19. #
  20. # Remove controller from the site
  21. Remove-XDController -AdminAddress XD001 -ControllerName XD002
  22. #
  23. # How to display/modify licensing details ?
  24. # Display licensing details
  25. Get-ConfigSite
  26. # Configure new settings for product code, edition and licensing model
  27. Set-ConfigSite -LicensingModel Concurrent -ProductCode MPS -ProductEdition ENT
  28. # Configure License server name and port
  29. Set-XDLicensing -LicenseServerAddress DC01 -LicenseServerPort 27001
  30. # Display licensing options
  31. Get-ConfigLicensingModel
  32. #
  33. # How to display/modify product version and edition ?
  34. # Configure new settings for product code, edition and licensing model
  35. Set-ConfigSite -ProductCode MPS -ProductEdition ENT
  36. # Display production options
  37. Get-ConfigProduct
  38. # Display product versions    
  39. Get-ConfigProductVersion                            
  40. # Display product editions
  41. Get-ConfigProductEdition
  42. #
  43. # Common Administrative Tasks for XenApp 6.5 and XenDesktop 7
  44. # --------------------------------------
  45. # To logoff a user from the farm:
  46. # Get-XASession | where { $_.AccountName -eq “DomainName\UserName"? } | Stop-XASession
  47. #
  48. # To Acquire a list of users connected to a published application:
  49. Get-XASession -BrowserName notepad | select AccountName
  50. #
  51. # Quickly disable logons for a server using PowerShell:
  52. Set-XAServerLogOnMode -LogOnMode $LM -ServerName $Server
  53. # Possible options for $LM: AllowLogOns, ProhibitNewLogOnsUntilRestart, ProhibitNewLogOns, ProhibitLogOns
  54. #
  55. # Published application management options
  56. # ----------------------------------------
  57. #
  58. # Change a published applications description field:
  59. Get-XAApplication -BrowserName “Excel 2010| Set-XAApplication -Description “Application Deleted”
  60. #
  61. # Rename a published application from/to:
  62. Get-XAApplication -BrowserName “Word 2010| Rename-XAApplication -NewDisplayName “Word 2010 - OLD”
  63. #
  64. # Acquire a list of running processes on running via a SessionID (user session) on a specific server:
  65. Get-XASessionProecss -ServerName UATXenDesktop7_01 -Sessionid 28
  66. # Where -ServerName is the server and -Sessionid is the users session
  67. #
  68. # Quickly grab all published applications on a server with PowerShell
  69. Get-XAApplication -ServerName UAT_XenDesktop7_01 | select DisplayName
  70. #
  71. # logoff a specific user who is running a published application in the farm
  72. (Get-XASession -BrowserName “PowerPoint 2010-ServerName UAT_XenDesktop7_01 | ? {$_.AccountName -match “LanID? }).SessionID | Stop-XASession
  73. #
  74. # Acquire the clients hostname/computername and ClientVersion:
  75. Get-XASession -BrowerName Excel | select ClientName, AccountName
  76. # Where -BrowserName is the published application
  77. #
  78. # Enumaerate all published destops in a farm with PowerShell
  79. Get-XAApplication | ? {$_.ApplicationType -eq “ServerDesktop” } | select DisplayName
  80. # Where _.Application and -eq are the parameters
  81. #
  82. # Enumerate all users/groups who have access to a published application:
  83. Get-XAAccount -BrowserName Bloomberg
  84. #
  85. # Get a list of all brokered connections
  86. Get-BrokerConnectionLog | Sort BrokeringTime
  87. #
  88. # Add an application to multiple delivery groups
  89. Add-BrokerApplication -Name "AppNameHere" -DesktopGroup "NewDesktopGroupHere"
  90. #
  91. Get-BrokerApplication -Name "Notepad"
  92. #
  93. # To set a different priority, use the '-priority' argument:
  94. Add-BrokerApplication -name "notepad" -DesktopGroup "Test Delivery Group" -Priority 5
  95. #
  96. Get-BrokerDBConnection Server=TESTSQL1;Initial Catalog=CitrixTestSite;Integrated Security=True
  97. #
  98. # XenDesktop Machines that have not been logged in to in the past XX days
  99. Get-BrokerDesktop -MaxRecordCount 2000 | Where {((Get-Date) - $_.LastConnectionTime).Days -gt 60} | sort LastConnectionTime | Select DNSName,LastConnectionTime,@{Name="UserName";Expression={$UserN = $_.AssociatedUserNames.Replace("YOURDOMAINHERE\",""); $UserObj = Get-ADUser -Filter {Name -eq $UserN}; "$($UserObj.GivenName) $($UserObj.Surname)"}}
  100. #
  101. #
  102. # Scenario: Provides list of all identity pools and detailed information about them, e.g., lock status and UID. This can be very useful when troubleshooting general catalog errors.
  103. Get-AcctIdentityPool
  104. #
  105. # Scenario: An attempt was made to delete a computer from the catalog and it failed mid-process. The account may have been deleted from Active Directory but left in an “in use” state in the catalog. To be able to reuse that computer name, the computer will have to be removed using the SID. The Get command will provide an administrator with the computer’s SID. Once the SID has been obtained, an administrator can then run the Remove command using the SID information.
  106. Get-AcctADAccount -IdentityPoolName “POOL NAME”
  107. Remove-AcctADAccount -IdentityPoolName “POOL NAME” -ADAccountSid “SID NUMBER” -Force
  108. #
  109. # Scenario: If a computer account becomes disabled or locked and goes into an “error” state, this command will resync the account with AD. This would usually happen when an account is manually deleted or disabled in AD but not from the catalog.
  110. Update-AcctADAccount -IdentityPoolName “POOL NAME”
  111. #
  112. # Scenario: Once a catalog has been created, an administrator will no longer be able to change the CPU and memory size through the studio. Instead, the administrator will have to use the commands below. The first command an administrator will need to run is Get-ProvSchema to obtain the ProvisioningSchemaName. Once that’s been obtained, an administrator will then run the Set-ProvSchema to update the memory and CPU data.
  113. Get-ProvSchema
  114. Set-ProvScheme -ProvisioningSchemeName “Schema Name” -VMMemoryMB “4096
  115. Set-ProvScheme -ProvisioningSchemeName “Schema Name” -VMCpuCount “2
  116. # Note: There’s no command to modify the PVD disk size. Although it can be modified by directly editing SQL, it isn’t a supported method. To change the PVD size after the catalog has been created, consult this Citrix KB article. Be aware, the method mentioned in this article will only apply to existing machines. Any new machines will continue using the size specified during the creation of the catalog.
  117. #
  118. # Scenario: An administrator attempts to make a change to a catalog and the studio freezes up, forcing the administrator to “end task” the console. In some situations, this might cause the catalog to enter into a “locked” state preventing any further changes to the catalog. The commands below will help with unlocking the catalog.
  119. Get-AccdIdentityPool
  120. Unlock-AcctIdentityPool -IdentityPoolName “POOL NAME”
  121. #
  122. # Scenario: When creating a catalog, an administrator has to choose data stores to be included in the catalog. If one of the data stores added fails or is removed from the hypervisor, the data store will need to be removed from the catalog as well. Otherwise, future attempts to update the catalog will fail. The first task is to find out the HypeHostingUnitStorage “path.” To do that, an administrator will first have to run the LS command to list all the HostingUnitStorages. Once that command has been run, an administrator should be able to find the storage path under the Storage field. With the Path available, an administrator can run the Remove command to remove the data store.
  123. CD XDHyp
  124. CD HostingUnits
  125. LS
  126. Remove-HypHostingUnitStorage -LiteralPath “PATH” -StoragePath “PATH” -StorageType PersonalvDiskStorage
Advertisement
Add Comment
Please, Sign In to add comment