Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use PowerShell of XenDesktop to do Update Machines-- qualified Pool

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/03 Report--

Recently, a customer thought that after updating the Windows 7 master,

Can update automatically every month without moving to Studio.

Therefore, a Powershell is written for this requirement and incorporated into the work schedule of Windows 2012.

First clarify the basic environment

Hypervisor:XenServer 6.5

OS:Windows 2012 R2

Desktop version: Xendesktop7.6.3

$Today=Get-Date-UFormat% Y%m%d_%H%M%S # # set Snapshot date

New-HypVMSnapshot-AdminAddress "ddc.citrix.com:80"-LiteralPath "XDHyp:\ HostingUnits\ dd\ Windows 7 test.vm"-SnapshotName "Citrix_$Today" # # VM running Snapshot

$ProvSchemeName = "TESTSCRIPTS" # # you need to define the name on your Machin Catalogs to do update

$Snapshot = "Citrix_$Today"

Start-Sleep-s 30 # # if we do not stop 30sec, our environment will cause problems to the number of people running below.

$VM = get-childitem-adminaddress "ddc.citrix.com:80"XDHyp:\ HostingUnits\ dd\" | where-object {$_ .ObjectType-eq 'VM'-and $_ .PSChildName-like' Windows 7 test.vm'} # # grab the VM path in Hypervisor for master update

$VMSnapshot = get-childitem-adminaddress "ddc.citrix.com:80" $VM.FullPath-Recurse-Include * .snapshot # # grab the Snapshot path 1 in the update VM machine

$TargetSnapshot = $VMSnapshot | Where-Object {$_ .FullName-eq "$snapshot.snapshot"} # # grab the Snapshot path 2 in the update VM machine

Set-ProvSchemeMetadata-AdminAddress "ddc.citrix.com:80"-Name "ImageManagementPrep_DoImagePreparation"-ProvisioningSchemeName "TESTSCRIPTS"-Value "True" # # prepare for updated process

Publish-provMasterVMImage-provisioningSchemeName $ProvSchemeName-MasterImageVM $TargetSnapshot.fullpath-AdminAddress "ddc.citrix.com:80"-RunAsynchronously # # start of execution update

Start-BrokerNaturalRebootCycle-AdminAddress "ddc.citrix.com:80"-InputObject @ ("TESTSCRIPTS") # # reopen directly after update

Refer to the web address:

Http://stealthpuppy.com/xendesktop-update-mcs-machine-catalog-powershell/

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report