Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Add-PSSnapin Citrix*
- #
- # How to check installed XenDesktop version ?
- Get-BrokerController
- Get-BrokerController |select DNSName, ControllerVersion
- #
- # How to display XenDesktop site configuration ?
- Get-XDSite
- # or
- Get-ConfigSite
- #
- # How to add/remove delivery controller ?
- # XenDesktop 7.6 install with powershell Part 1 - Figure 14
- # -AdminAddress - controller we will connect to
- # -ControllerName - controller we will add/remove
- #
- # Add new controller to the site
- Add-XDController -AdminAddress XD001 -ControllerName XD002
- #
- # Remove controller from the site
- Remove-XDController -AdminAddress XD001 -ControllerName XD002
- #
- # How to display/modify licensing details ?
- # Display licensing details
- Get-ConfigSite
- # Configure new settings for product code, edition and licensing model
- Set-ConfigSite -LicensingModel Concurrent -ProductCode MPS -ProductEdition ENT
- # Configure License server name and port
- Set-XDLicensing -LicenseServerAddress DC01 -LicenseServerPort 27001
- # Display licensing options
- Get-ConfigLicensingModel
- #
- # How to display/modify product version and edition ?
- # Configure new settings for product code, edition and licensing model
- Set-ConfigSite -ProductCode MPS -ProductEdition ENT
- # Display production options
- Get-ConfigProduct
- # Display product versions
- Get-ConfigProductVersion
- # Display product editions
- Get-ConfigProductEdition
- #
- # Common Administrative Tasks for XenApp 6.5 and XenDesktop 7
- # --------------------------------------
- # To logoff a user from the farm:
- # Get-XASession | where { $_.AccountName -eq “DomainName\UserName"? } | Stop-XASession
- #
- # To Acquire a list of users connected to a published application:
- Get-XASession -BrowserName notepad | select AccountName
- #
- # Quickly disable logons for a server using PowerShell:
- Set-XAServerLogOnMode -LogOnMode $LM -ServerName $Server
- # Possible options for $LM: AllowLogOns, ProhibitNewLogOnsUntilRestart, ProhibitNewLogOns, ProhibitLogOns
- #
- # Published application management options
- # ----------------------------------------
- #
- # Change a published applications description field:
- Get-XAApplication -BrowserName “Excel 2010” | Set-XAApplication -Description “Application Deleted”
- #
- # Rename a published application from/to:
- Get-XAApplication -BrowserName “Word 2010” | Rename-XAApplication -NewDisplayName “Word 2010 - OLD”
- #
- # Acquire a list of running processes on running via a SessionID (user session) on a specific server:
- Get-XASessionProecss -ServerName UATXenDesktop7_01 -Sessionid 28
- # Where -ServerName is the server and -Sessionid is the users session
- #
- # Quickly grab all published applications on a server with PowerShell
- Get-XAApplication -ServerName UAT_XenDesktop7_01 | select DisplayName
- #
- # logoff a specific user who is running a published application in the farm
- (Get-XASession -BrowserName “PowerPoint 2010” -ServerName UAT_XenDesktop7_01 | ? {$_.AccountName -match “LanID? }).SessionID | Stop-XASession
- #
- # Acquire the clients hostname/computername and ClientVersion:
- Get-XASession -BrowerName Excel | select ClientName, AccountName
- # Where -BrowserName is the published application
- #
- # Enumaerate all published destops in a farm with PowerShell
- Get-XAApplication | ? {$_.ApplicationType -eq “ServerDesktop” } | select DisplayName
- # Where _.Application and -eq are the parameters
- #
- # Enumerate all users/groups who have access to a published application:
- Get-XAAccount -BrowserName Bloomberg
- #
- # Get a list of all brokered connections
- Get-BrokerConnectionLog | Sort BrokeringTime
- #
- # Add an application to multiple delivery groups
- Add-BrokerApplication -Name "AppNameHere" -DesktopGroup "NewDesktopGroupHere"
- #
- Get-BrokerApplication -Name "Notepad"
- #
- # To set a different priority, use the '-priority' argument:
- Add-BrokerApplication -name "notepad" -DesktopGroup "Test Delivery Group" -Priority 5
- #
- Get-BrokerDBConnection Server=TESTSQL1;Initial Catalog=CitrixTestSite;Integrated Security=True
- #
- # XenDesktop Machines that have not been logged in to in the past XX days
- 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)"}}
- #
- #
- # 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.
- Get-AcctIdentityPool
- #
- # 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.
- Get-AcctADAccount -IdentityPoolName “POOL NAME”
- Remove-AcctADAccount -IdentityPoolName “POOL NAME” -ADAccountSid “SID NUMBER” -Force
- #
- # 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.
- Update-AcctADAccount -IdentityPoolName “POOL NAME”
- #
- # 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.
- Get-ProvSchema
- Set-ProvScheme -ProvisioningSchemeName “Schema Name” -VMMemoryMB “4096″
- Set-ProvScheme -ProvisioningSchemeName “Schema Name” -VMCpuCount “2″
- # 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.
- #
- # 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.
- Get-AccdIdentityPool
- Unlock-AcctIdentityPool -IdentityPoolName “POOL NAME”
- #
- # 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.
- CD XDHyp
- CD HostingUnits
- LS
- Remove-HypHostingUnitStorage -LiteralPath “PATH” -StoragePath “PATH” -StorageType PersonalvDiskStorage
Advertisement
Add Comment
Please, Sign In to add comment