Delete a DesktopGroup
来源:互联网 发布:java模板t 编辑:程序博客网 时间:2024/05/19 03:42
# —————————————————————————————————
#PowerShell sample script to delete a desktop group and related objects from a XenDesktop 5.x site
#
#Note: One or more required values must be specified below before executing the script.
#
#
#
#Version 1.0
#———————————————————————————————–
#Provide the following values before executing:
#The FQDN for the DDC and XML port, if not the default of 80
#Eg: ‘ddc01.domain.com:80’
$ddcAddress = ”
#The name of the desktop group to be removed
$desktopGroupName = ”
#End of variables
#******************************************************************
asnp Citrix.*
#Get a collection of the desktops in the desktop group
$desktops = Get-BrokerDesktop -DesktopGroupName $desktopGroupName -AdminAddress $ddcAddress
#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 -DesktopGroup $desktopGroupName -AdminAddress $ddcAddress
#Get the access policy rules with the desktop group as an included desktop group
$aprs = Get-BrokerAccessPolicyRule -IncludedDesktopGroup $desktopGroupName -AdminAddress $ddcAddress
#Loop through the access policy rules
ForEach ($apr in $aprs) {
#Determine if the desktop group is the only referenced by the rule
If ($apr.IncludedDesktopGroups.Length -eq 1) {
#The desktop group is the only one referencing this rule; remove the rule
Remove-BrokerAccessPolicyRule -Name $apr.Name -AdminAddress $ddcAddress
} ElseIf ($apr.IncludedDesktopGroups.Length -gt 1) {
#This rule is being applied to more than one desktop group
#Get a list of the desktop groups with the (target) desktop group removed
$dgs = $apr.IncludedDesktopGroups | Where-Object { $_.Name -ne $desktopGroupName}
#Set the access policy rule to use the updated desktop groups list (sans target desktop group)
Set-BrokerAccessPolicyRule -Name $apr.Name -IncludedDesktopGroups $dgs -AdminAddress $ddcAddress
}
}
#Get the desktop group object for the desktop group
$desktopGroup = Get-BrokerDesktopGroup -Name $desktopGroupName -AdminAddress $ddcAddress
#Get the entitlement policy rules applied to this desktop group
$eprs = Get-BrokerEntitlementPolicyRule -DesktopGroupUid $desktopGroup.Uid -AdminAddress $ddcAddress
#Remove each entitlement policy rule
ForEach ($epr in $eprs) {
Remove-BrokerEntitlementPolicyRule -Name $epr.Name -AdminAddress $ddcAddress
}
#Remove the desktop group
Remove-BrokerDesktopGroup -Name $desktopGroupName -AdminAddress $ddcAddress
- Delete a DesktopGroup
- delete a和delete []a 的分别
- Creating a Delete Button
- js dynamic delete a row
- Delete text in a RichTextBox
- Delete numbers in a string
- Delete Node in a BST
- Delete Node in a BST
- Delete Node in a BST
- Delete Node In A LinkedList
- 请教:a 和 *(&a) 有什么区别,"delete a" 和 "delete []a"又有什么区别?
- sql--Delete repeated items from a table
- Delete a file cannot be deleted
- How to delete a DFF Context
- Thoroughly delete VSS in a project
- delete a NULL pointer is safe
- Delete elements while iterating a list
- jQuery & Cookies (get/set/delete & a plugin)
- leetcode-Unique Paths II
- 08-图9 关键活动 (30分)
- Android的api对应不同系统以及图片
- 数据类型及类型间转换
- java重载与重写的区别+重写父类equals方法的完美实现
- Delete a DesktopGroup
- mysql数据库常用命令
- 【黑马程序员】StringBuffer,Array,Integer,BigInteger,Date,Calendar,集合——Java复习笔记
- [sicily]1433. Optimal Parking
- @Controller、@RequestMapping
- 在IOS8及IOS9中使用UILocationNotification本地推送时不显示推送
- Java基础(14):网络编程之socket
- UIPickerView
- Android开源BezierView:仿QQ未读消息99+条的红色气泡