Presentation is loading. Please wait.

Presentation is loading. Please wait.

Troubleshooting a XenDesktop Environment Using the PowerShell SDK SUM406 Shaun Wendland, Senior Escalation Engineer May 21, 2013.

Similar presentations


Presentation on theme: "Troubleshooting a XenDesktop Environment Using the PowerShell SDK SUM406 Shaun Wendland, Senior Escalation Engineer May 21, 2013."— Presentation transcript:

1 Troubleshooting a XenDesktop Environment Using the PowerShell SDK SUM406 Shaun Wendland, Senior Escalation Engineer May 21, 2013

2 © 2013 Citrix Roadmap for the session The PowerShell SDK – what is it and how can I use it? Cmdlet usage and scripting fundamentals Advanced configuring/troubleshooting sites using scripts Citrix tools using the PowerShell SDK Resources discussed, Q&A © 2013 Citrix

3 What is the PowerShell SDK? Working with the XenDesktop PowerShell SDK

4 © 2013 Citrix PowerShell SDK  Drives.NET interactions for: Desktop Studio Administrator Actions  Installed by default  Required for advanced configurations  Automates common tasks  Provides a foundation for troubleshooting issues Powered By:

5 © 2013 Citrix Windows PowerShell Windows PowerShell is Microsoft’s task automation framework Replacement for the command prompt Releases: v1.0v3.0v2.0

6 © 2013 Citrix Windows PowerShell Windows PowerShell is Microsoft’s task automation framework Extensible snap-in architecture provides a.NET “bridge” to virtually any aspect of a Windows machine Snap-Ins consist of cmdlets, and provide a common scripting environment for both administrators and applications Cmdlets represent instances of.NET Framework classes; they are not stand- alone executables

7 © 2013 Citrix The XenDesktop PowerShell SDK at a Glance 7 Snap-Ins with nearly 300 cmdlets in the XenDesktop 5.6 PowerShell SDK XenDesktop PowerShell cmdlets perform an action with the XenDesktop environment Two “types” of cmdlets – configuring and polling Most cmdlets return a Microsoft.NET Framework object Parameters allow filtered data to be returned Cmdlets can be executed from a remote PowerShell session with the SDK installed

8 © 2013 Citrix Working with the XenDesktop PowerShell SDK The XenDesktop PowerShell SDK is split into separate snap-ins for each service on a Desktop Delivery Controller Installable on any Windows computer that supports PowerShell v2.0  Separate installers for each snap-in  Located on XenDesktop install disc \[x86/x64]\Citrix Desktop Delivery Controller -Citrix.Common.Commands -6 x “PowerShellSnapIn”

9 © 2013 Citrix Working with the XenDesktop PowerShell SDK Cmdlets follow the standard “Verb-Item” syntax  Get-BrokerSite – Gets the Broker Site  Get-BrokerDesktop – Gets a Broker Desktop Each cmdlet has extensive help text with syntax examples  Get-Help Get-BrokerSite -Full Use Add-PSSnapin to load the snap-in  Add-PSSnapin Citrix.Broker.Admin.V1  Add-PSSnapin Citrix.Broker*  Add-PSSnapin Citrix.*  Alias: asnp Executing remotely  Parameter -AdminAddress $ddcAddress ‘ddc01.domain.com:80’ Get-Rename- Set-Update- Add-Reset- Remove-

10 XenDesktop Scripting Common PowerShell SDK cmdlets and scripts

11 © 2013 Citrix Scripting Essentials Integrated Scripting Environments (ISE)  Script Editor Multi-line editing Syntax coloring Tab completion Variables and Console panes  Live Debugging Breakpoints and step-in/out  Intelli-sense!

12 © 2013 Citrix Intelli-sense Provides context-specific assistance that:  Speeds up the process of coding by reducing typo's and other common syntax errors  Uses auto-completion popups, populated by querying parameters of cmdlets, as well as each parameter’s possible value.  Provides documentation and disambiguation for variable names, functions and methods.

13 © 2013 Citrix Scripting Essentials Integrated Scripting Environments (ISE)  Free Script Editing Software: Windows ® PowerShell ISE Jive PowerGUI Idera ® PowerShell+  Paid Script Editing Software: Sapien PowerShell Studio Sapien PrimalScript

14 © 2013 Citrix XenDesktop Cmdlets Common Desktop Cmdlets Desktop Desktop Delivery Controller

15 © 2013 Citrix Common Desktop Cmdlets Get-BrokerDesktop Get-BrokerDesktopGroup / Set-BrokerDesktopGroup Desktop

16 © 2013 Citrix Common Controller Cmdlets Get-ServiceServiceStatus Get-ConfigRegisteredServiceInstance | Test-ConfigServiceInstanceAvailability Get-BrokerSite / Set-BrokerSite AD Identity Service Broker Service Configuration Service Host Service Machine Creation Service Machine Identity Service Desktop Delivery Controller – Get-ConfigServiceStatus – Get-AcctServiceStatus – Get-HypServiceStatus – Get-ProvServiceStatus – Get-PvsVmServiceStatus – Get-BrokerServiceStatus – Instances 3 3 – Instance 1 1 – Instances – Instance 1 1 – Instances 2 2

17 Advanced XenDesktop Configuring / Troubleshooting Using PowerShell SDK cmdlets to troubleshoot complex issues and automate tasks

18 © 2013 Citrix Troubleshooting service instance registrations Broken or “Missing” service instance registrations  Clear all service instance registrations but the licensing service before re-registering $instance | Unregister-ConfigRegisteredServiceinstance  Re-register the DDCs to the site Get-ServiceServiceInstance -AdminAddress $ddcAddress | Register-ConfigServiceInstance Get-ConfigRegisteredServiceInstance -AdminAddress $ddcAddress | Reset-ServiceServiceGroupMembership

19 © 2013 Citrix Joining a Controller to a Site Confirm the DDC isn’t already part of a site  Get-ItemProperty -Path 'HKLM:\SOFTWARE\Citrix\DesktopServer\DataStore\ Connections\Controller' -Name ConnectionString Generate the T-SQL join script for each service  Get-ServiceDBSchema -DatabaseName $dbName -ScriptType Instance -ServiceGroupName $siteName

20 © 2013 Citrix Joining a Controller to a Site Set database connection strings for each service  Set-ServiceDBConnection -DBConnection $cs Register service instances to the site  Get-ServiceServiceInstance | Register-ConfigServiceInstance  Get-ConfigRegisteredServiceInstance | Reset-ServiceServiceGroupMembership

21 © 2013 Citrix Creating and Configuring a Desktop Group Create the new Desktop Group and configuring its settings  New-BrokerDesktopGroup Add the desktop machines to the Desktop Group  Add-BrokerMachinesToDesktopGroup Create a new Broker User for each user  New-BrokerUser Create an Entitlement Policy Rule to grant the users access  New-BrokerEntitlementPolicyRule Desktops Entitlement Policy Rule Access Policy Rule Power Time Scheme Desktop Group

22 © 2013 Citrix Creating and Configuring a Desktop Group Create an Access Policy Rule for the Desktop Group  New-BrokerAccessPolicyRule Create a Power Time Scheme for the Desktop Group  New-BrokerPowerTimeScheme

23 © 2013 Citrix Removing Desktops & Deleting Desktop Groups Remove desktops from the Desktop Group  Removing a single desktop from a Desktop Group Remove-BrokerMachine -MachineName $machineSamName -DesktopGroup $desktopGroupName  Removing all desktops from a Desktop Group Get a collection of the desktops in the Desktop Group -$desktops = Get-BrokerDesktop -DesktopGroupName $desktopGroupName Get the machine UIDs for each desktop -$machineUids = $desktops | ForEach {$_.MachineUid} Use the collection of machine UIDs to remove them from the Desktop Group -Remove-BrokerMachine -InputObject $machineUids -DesktopGroupName $desktopGroupName

24 © 2013 Citrix Removing Desktops & Deleting Desktop Groups Remove the Entitlement Policy Rule  Remove-BrokerEntitlementPolicyRule -Name $entitlementPolicyName Remove the Access Policy Rule  Remove-BrokerAccessPolicyRule -Name $accessPolicyName Remove the Power Time Scheme  Remove-BrokerPowerTimeScheme -Name $powerTimeSchemeName Remove the Desktop Group  Remove-BrokerDesktopGroup -Name $desktopGroupName

25 © 2013 Citrix Monitoring and Managing Desktops Loop through desktops to check power, registration, and summary states of virtual desktops  Get-BrokerDesktop | Select MachineName, PowerState, RegistrationState, SummaryState Use XenDesktop power actions to manage desktop power states  New-BrokerHostingPowerAction Sends power actions through XenDesktop

26 © 2013 Citrix Monitoring and Managing Desktops Use WMI to check Windows vitals (services, CPU, Memory, Disk, etc.)  E.g. Get-WMIObject win32_service -ComputerName $name | Select Name, State Use methods on WMI objects to perform actions against them  Find methods of an object $object | Get-Member -MemberType Methods  E.g. Restarting the VDA service

27 XenDesktop Site Checker & WorkerDiag Citrix tools that leverage the PowerShell SDK

28 © 2013 Citrix Site Checker Provides the ability to perform various administrative tasks that aren’t available in Desktop Studio Checks that all services are running on all Controllers and manages services to correct problems Checks service instance registrations and notifies of registration issues found and can correct them using the PowerShell SDK XenDesktop Diagnostic Tool

29 © 2013 Citrix Site Checker Builds a treenode view of the site Provides properties for the active node All PowerShell scripts are logged in the log viewer pane  Scripts can easily be copied/pasted into a script editor for reuse XenDesktop Diagnostic Tool

30 © 2013 Citrix WorkerDiag Extension of Site Checker Provides reporting of desktops that combines XenDesktop PowerShell SDK with Windows Management Instrumentation Checks workers for common issues  VDA services  ListOfDDCs registry value  Last Deregistration time, Last Power Action Reason Right-click context allows quick management of VMs Sorting and color coding make it easy to identify problematic VMs Allows export to CSV for reporting

31 © 2013 Citrix Resources Discussed ShareFile Download for the Presentation Example Scripts https://citrix.sharefile.com/d/sf33d6a504d747f0b XenDesktop PowerShell SDK Help Microsoft PowerShell Script Center PowerShell v2.0 Download PowerShell v3.0 Download XenDesktop Site Checker XenDesktop WorkerDiag

32 Q&A Troubleshooting a XenDesktop Environment Using the PowerShell SDK

33 © 2013 Citrix Before you leave… 33 Conference surveys are available online at starting Friday, May 24 at 9:00 a.m. PTwww.citrixsynergy.com  Provide your feedback by 4:00 p.m. PT that day and you’ll receive a $30 Amazon.com gift card via Download presentations starting Monday, June 3, from your My Conference Planning tool located within the My Account section

34 Work better. Live better.


Download ppt "Troubleshooting a XenDesktop Environment Using the PowerShell SDK SUM406 Shaun Wendland, Senior Escalation Engineer May 21, 2013."

Similar presentations


Ads by Google