Tải bản đầy đủ - 0 (trang)
Installing the XenApp® 6.5 PowerShell SDK

Installing the XenApp® 6.5 PowerShell SDK

Tải bản đầy đủ - 0trang

PowerShell and Command-line Tooling

5. Select the Update the execution policy option and click on Next.



6. Click on Install.

7. Click on Finish.

8. Start Windows PowerShell with Citrix XenApp 6.5 SDK by navigating to Start | All

Programs | Citrix | XenApp 6.5 Server SDK.

The required PowerShell snap-ins are automatically loaded when the

Windows PowerShell with Citrix XenApp 6.5 SDK shortcut is started.



The following screenshot shows the snap-ins that are automatically loaded when the Windows

PowerShell with Citrix XenApp 6.5 SDK shortcut is used from the Start menu:



302



www.it-ebooks.info



Chapter 10



Replicating printer drivers with PowerShell

This recipe will show you how to replicate printer drivers between XenApp servers using

PowerShell commands.



Getting ready

To use the provided PowerShell commands, the XenApp PowerShell SDK needs to be installed.

Check Installing the XenApp 6.5 PowerShell SDK for the installation

instructions.



Ensure that the required PowerShell execution mode is set. To check the execution mode, run

the following PowerShell command:

Get-ExecutionPolicy



If the mode is set to restricted, change it to the required mode with the following command:

Set-ExecutionPolicy RemoteSigned



How to do it...

To replicate printer drivers with PowerShell, perform the following steps:

1. Open Windows PowerShell with Citrix XenApp 6.5 Server SDK by navigating to Start |

All Programs | Citrix | XenApp 6.5 Server SDK.

2. Run the following PowerShell command to get an overview of the installed print

drivers on the XenApp server that will be used as the source:

Get-XAPrinterDriver -Servername CBXA01 | Format-Wide -Property

DriverName



You need to provide the full printer driver name with the replication

commands; so, note down the full driver name for future reference.



303



www.it-ebooks.info



PowerShell and Command-line Tooling

3. Run the following PowerShell command to manually replicate a printer driver:

Start-XAPrinterDriverReplication -DriverName "hp deskjet 5550

series (HPA)" -TargetServerName CBXA02



4. Retrieve all the autoreplicated printer drivers with the following command:

Get-XAAutoReplicatedPrinterDriver



5. Run the following PowerShell command to add a printer driver to the autoreplication

list, and have it automatically replicated to the XenApp servers in the Farm:

Add-XAAutoReplicatedPrinterDriver –DriverName "HP Universal

Printing PCL 6" –ServerName CBXA01



6. To remove a printer driver from the autoreplication list, run the following command:

Remove-XAAutoReplicatedPrinterDriver –DriverName "HP Universal

Printing PCL 6" –ServerName CBXA01



304



www.it-ebooks.info



Chapter 10

Keep in mind that it might take a few minutes before the printer driver is

replicated and shown as an installed driver on the destination XenApp

server. Removing a printer driver from the replication list does not

remove it from the XenApp servers in the Farm.



There's more...

You can read more about printer driver replication with PowerShell at Citrix's Knowledge

Center at http://support.citrix.com/article/CTX126125.



Creating Citrix® policies with PowerShell

A lot of Citrix XenApp 6.5 features and settings are managed through Citrix policies. This

recipe will show you how to create Citrix policies with PowerShell commands and scripts.



Getting ready

To use the provided PowerShell commands, the XenApp PowerShell SDK needs to be installed.

Check Installing the XenApp 6.5 PowerShell SDK for the

installation instructions.



Ensure that the required PowerShell execution mode is set. To check the execution mode,

run the following PowerShell command:

Get-ExecutionPolicy



If the mode is set to restricted, change it to the required mode with the following command:

Set-ExecutionPolicy RemoteSigned



How to do it...

To create a Citrix policy, perform the following steps:

1. Open Windows PowerShell with Citrix XenApp 6.5 Server SDK by navigating to Start |

All Programs | Citrix | XenApp 6.5 Server SDK.

The PowerShell scripts in this recipe assume that policies are created

and managed with AppCenter and not with Microsoft's Group Policy

Management Console.

305



www.it-ebooks.info



PowerShell and Command-line Tooling

2. Create a new Citrix computer policy with the following command:

New-Item 'LocalFarmGpo:\Computer\Basic XenApp Settings'



3. Configure the common policy settings with the following commands:

# Navigate to policy settings:

cd 'LocalFarmGpo:\Computer\Basic Settings\Settings\'

# Set DNS address resolution:

Set-ItemProperty '.\ServerSettings\DnsAddressResolution' -Name

State -Value Enabled

# Set License server host name:

Set-ItemProperty '.\Licensing\LicenseServerHostName' -Name Value

-Value CBDC01

# Set License server port:

Set-ItemProperty '.\Licensing\LicenseServerPort' -Name Value

-Value 27000

# Set Load Evaluator Name:

Set-ItemProperty '.\ServerSettings\LoadEvaluator' -Name Value

-Value 'Load Evaluator - max users'

# Set XenApp product edition:

Set-ItemProperty '.\ServerSettings\ProductEdition' -Name Value

-Value Platinum

# Set XenApp product model:

Set-ItemProperty '.\ServerSettings\ProductModel' -Name Value

-Value XenAppCCU

# Set XML Service Port:

Set-ItemProperty '.\XMLService\XmlServicePort' -Name Value -Value

8080



4. If a policy setting needs to be removed, use the following command:

Set-ItemProperty '.' -Name State -Value

NotConfigured



5. To set a policy setting to Disabled, use the following command:

Set-ItemProperty '.' -Name State -Value

Disabled



6. To set a policy setting to Enabled, use the following command:

Set-ItemProperty '.' -Name State -Value

Enabled



306



www.it-ebooks.info



Chapter 10



How it works...

The Citrix XenApp 6.5 SDK offers a Citrix.Common,GroupPolicy snap-in that enables you

to create and configure Citrix policies on a XenApp server. This snap-in uses a LocalFarmGpo

PowerShell drive to navigate through the Citrix policies and manage the settings.

To create a new Citrix computer policy, use the following command:

New-Item 'LocalFarmGpo:\Computer\'



To check a policy setting, run the following command:

Get-ItemProperty ".\Computer\Basic Settings\Settings\"



The returned state will indicate whether the setting is

enabled or not.



To edit a policy setting, use the following command:

Set-ItemProperty LocalFarmGpo:\Computer\\

Settings\ -Name Value -Value



A small selection of the Citrix computer policy categories and settings that can be configured

with the LocalFarmGpo PowerShell drive, are shown in the following table:

Category



Subcategory



Settings



ICA



It doesn't have a

subcategory



IcaListenerPortNumber and

IcaListenerTimeout



Graphics



DisplayDegradePreference,

DisplayDegradeUserNotification,

DisplayMemoryLimit, ImageCaching,

and MaximumColorDepth



ServerLimits



IdleTimerInterval



SessionReliability



SessionReliabilityConnections,

SessionReliabilityPort, and

SessionReliabilityTimeout



Shadowing



Shadowing



It doesn't have a

subcategory



LicenseServerHostName and

LicenseServerPort



Licensing



307



www.it-ebooks.info



PowerShell and Command-line Tooling

Category



Subcategory



Settings



ServerSettings



It doesn't have a

subcategory



DnsAddressResolution,

FullIconCaching, InitialZone,

LoadEvaluator, ProductEdition,

and ProductModel



DatabaseSettings



InitialDatabaseName,

InitialDatabaseServerName, and

InitialFailoverPartner



It doesn't have a

subcategory



TrustXmlRequests and

XmlServicePort



XMLService



Use Tab to autocomplete the path to each policy setting. A complete

list of the available group policy settings can be found in the Citrix

XenApp 6.5 Server SDK Help file.



Changing the XenApp® product edition with

PowerShell

With Citrix XenApp 6.5, the product edition for each Citrix XenApp server is set with a Citrix

Computer policy. The product edition of a XenApp server must match with the product edition

from the license file to ensure that a license is allocated for each logged on user or device.

This recipe will provide the required PowerShell commands and scripts to change the XenApp

product edition by creating that Citrix Computer policy.



Getting ready

To use the provided PowerShell commands, the XenApp PowerShell SDK needs to be installed.

Check Installing the XenApp 6.5 PowerShell SDK for the installation

instructions.



Ensure that the required PowerShell execution mode is set. To check the execution mode, run

the following PowerShell command:

Get-ExecutionPolicy



308



www.it-ebooks.info



Chapter 10

If the mode is set to restricted, change it to the required mode with the following command:

Set-ExecutionPolicy RemoteSigned



How to do it...

To change the XenApp 6.5 product edition with PowerShell, perform the following steps:

1. Open Windows PowerShell with Citrix XenApp 6.5 Server SDK by navigating to Start |

All Programs | Citrix | XenApp 6.5 Server SDK.

2. Configure the product edition with the following command:

# Navigate to Unfiltered policy settings:

cd 'LocalFarmGpo:\Computer\Unfiltered\Settings\'

# Set XenApp product edition:

Set-ItemProperty '.\ServerSettings\ProductEdition' -Name Value

-Value Platinum



3. Ensure that the policy setting is enabled with the following command:

Set-ItemProperty '.\ServerSettings\ProductEdition' -Name State

-Value Enabled



You can find the configured product edition of the XenApp server in the

registry at HKLM\SYSTEM\CurrentControlSet\Control\Citrix.



Creating a basic XenApp® inventory report

with PowerShell

This recipe will show you how to display the basic XenApp Farm information in a simple HTML

report using a PowerShell script.



309



www.it-ebooks.info



PowerShell and Command-line Tooling



Getting ready

To use the provided PowerShell commands, the XenApp PowerShell SDK needs to be installed.

Check Installing the XenApp 6.5 PowerShell SDK for the

installation instructions.



Ensure that the required PowerShell execution mode is set. To check the execution mode, run

the following PowerShell command:

Get-ExecutionPolicy



If the mode is set to restricted, change it to the required mode with the following command:

Set-ExecutionPolicy RemoteSigned



How to do it...

To create an HTML report with basic XenApp Farm information, perform the following steps:

1. Open Windows PowerShell with Citrix XenApp 6.5 Server SDK by navigating to Start |

All Programs | Citrix | XenApp 6.5 Server SDK.

2. Create the HTML report by running the following PowerShell script:

$Farm = Get-XAFarm | ConvertTo-HTML FarmName,ServerVersion,Session

Count -Fragment

$Servers = Get-XAServer | ConvertTo-HTML ServerName,ZoneName,Elect

ionPreference,OSVersion,OSServicePack,CitrixVersion,CitrixEdition,

CitrixServicePack,LogOnMode -Fragment

$Applications = Get-XAApplication | ConvertTo-HTML ApplicationType

,DisplayName,Description,Enabled,PreLaunch -Fragment

$Output = "

XenApp Farm Inventory

$Farm"

$Output += "

$Servers

"

$Output += "

$Applications

"

ConvertTo-HTML -Body $Output -Title "XenApp Farm Report" | OutFile C:\temp\XAFarmReport.htm

Invoke-Item C:\temp\XAFarmReport.htm



The preceding script is a small example of how PowerShell can aid

in reporting on XenApp Farm settings. To document all XenApp Farm

settings for future reference, I recommend that you use Carl Webster's

script that will be discussed in Chapter 12, Citrix® Community.



310



www.it-ebooks.info



Chapter 10

A sample of the generated HTML report is shown in the following screenshot:



Managing Farm administration roles with

PowerShell

This recipe will show you how to manage the administrators of Citrix XenApp Farm with

PowerShell commands.



Getting ready

To use the provided PowerShell commands, the XenApp PowerShell SDK needs to be installed.

Check Installing the XenApp 6.5 PowerShell SDK for the

installation instructions.



Ensure that the required PowerShell execution mode is set. To check the execution mode, run

the following PowerShell command:

Get-ExecutionPolicy



If the mode is set to restricted, change it to the required mode with the following command:

Set-ExecutionPolicy RemoteSigned



311



www.it-ebooks.info



PowerShell and Command-line Tooling



How to do it...

To manage the XenApp Farm administrators with PowerShell, perform the following steps:

1. Open Windows PowerShell with Citrix XenApp 6.5 Server SDK by navigating to

Start | All Programs | Citrix | XenApp 6.5 Server SDK.

2. Check the current Farm administrators by running the following PowerShell script:

Get-XAAdministrator



3. Create a new Farm administrator with the following command:

New-XAAdministrator CBLAB\cbtester05 -AdministratorType Custom

-Enabled False -FarmPrivileges ViewFarm,ViewPrinterDrivers



4. Set FolderPrivileges for the newly created administrator with the

following command:

Set-XAAdministratorFolder CBLAB\cbtester05 -Folderpath

Applications –FolderPrivileges ViewApplications,EditApplications,

ViewSessions,ConnectSessions,SendMessages,LogOffSessions,Disconnec

tSessions



312



www.it-ebooks.info



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

Installing the XenApp® 6.5 PowerShell SDK

Tải bản đầy đủ ngay(0 tr)

×