How to use XenDesktop PowerShell to do update machines--limit pool

Source: Internet
Author: User

Recently, a customer has been able to update the Windows 7 Master

Without moving to studio, you can update it every month,

So I wrote a PowerShell for this requirement and set it up in Windows 2012.


First, the basic environment.

Hypervisor:xenserver 6.5

Os:windows R2

Virtual Desktop version: Xendesktop7.6.3



$Today = get-date -uformat %y%m%d_%h%m%s # #設定Snapshot日期

New-hypvmsnapshot  -adminaddress "ddc.citrix.com:80" -literalpath "Xdhyp:\hostingunits\dd\windows 7 TEST.VM" -snapshotname "Citrix_$Today"# #執行Snapshot的VM

$ProvSchemeName = "TESTSCRIPTS" # #需要針對你的Machin the name definition on catalogs to do update

$Snapshot = "Citrix_ $Today "

Start-sleep - S In the #如果不停止30sec, the environment on my side will take a couple of paths to the next number of variables.


$VM = Get-childitem -adminaddress "ddc.citrix.com:80" "Xdhyp:\hostingunits\dd\" | Where-object {$_.ObjectType -eq ' VMS ' -and $_.Pschildname -like ' Windows 7 test.vm '} # #抓取Hypervisor中要做母版更新的VM路徑


$VMSnapshot = Get-childitem -adminaddress "ddc.citrix.com:80" $VM.FullPath -recurse -include *.snapshot # #抓取更新VM機器之中的Snapshot路徑1

$TargetSnapshot = $VMSnapshot | Where-object {$_.FullName -eq "$snapshot. Snapshot "} # #抓取更新VM機器之中的Snapshot路徑2

Set-provschememetadata  -adminaddress "ddc.citrix.com:80"  -name "Imagemanagementprep_doimagepreparation" -provisioningschemename "TESTSCRIPTS" -value "True" # #準備更新的process

Publish-provmastervmimage -provisioningschemename $ProvSchemeName -MASTERIMAGEVM $TargetSnapshot.FullPath -adminaddress "ddc.citrix.com:80" -runasynchronously # #執行更新開始

start-brokernaturalrebootcycle  -adminaddress "ddc.citrix.com:80" -inputobject @("TESTSCRIPTS") # #更新後直接重開


Reference Web site:

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


This article is from the "Michael's Road to Citrix" blog, so be sure to keep this source http://10802310.blog.51cto.com/10792310/1903739

How to use XenDesktop PowerShell to do update machines--limit pool

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.