Skip to content

Commit dfec36f

Browse files
Policies scripts
1 parent 0bd6f37 commit dfec36f

File tree

50 files changed

+4596
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+4596
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Adds machines from a catalog to a desktop group
6+
7+
.DESCRIPTION
8+
9+
.NOTES
10+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
11+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
12+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
13+
the use and the consequences of the use of this freely available script.
14+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
15+
© ScriptRunner Software GmbH
16+
17+
.COMPONENT
18+
Requires the library script CitrixLibrary.ps1
19+
Requires PSSnapIn Citrix*
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/blob/master/Citrix/Administration
23+
24+
.Parameter SiteServer
25+
[sr-en] Specifies the address of a XenDesktop controller.
26+
This can be provided as a host name or an IP address
27+
[sr-de] Name oder IP Adresse des XenDesktop Controllers
28+
29+
.Parameter Catalog
30+
[sr-en] Name or Uid of the machine catalog
31+
[sr-de] Name oder Uid des Maschinenkatalogs
32+
33+
.Parameter Count
34+
[sr-en] Number of machines to add to the desktop group
35+
[sr-de] Anzahl der Maschinen die zur Bereitstellungsgruppe hinzufügt werden
36+
37+
.Parameter DesktopGroup
38+
[sr-en] Desktop group to which the machines are added, specified by name or Uid
39+
[sr-de] Desktop-Gruppe zu der die Maschinen hinzugefügt werden, Name oder Uid
40+
#>
41+
42+
param(
43+
[Parameter(Mandatory = $true)]
44+
[string]$Catalog,
45+
[Parameter(Mandatory = $true)]
46+
[int]$Count,
47+
[Parameter(Mandatory = $true)]
48+
[string]$DesktopGroup,
49+
[string]$SiteServer
50+
)
51+
52+
$LogID = $null
53+
[bool]$success = $false
54+
try{
55+
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
56+
57+
StartLogging -ServerAddress $SiteServer -LogText "Add $($Count) machines to desktop group $($DesktopGroup)" -LoggingID ([ref]$LogID)
58+
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
59+
'AdminAddress' = $SiteServer
60+
'Catalog' = $Catalog
61+
'DesktopGroup' = $DesktopGroup
62+
'Count' = $Count
63+
'LoggingID' = $LogID
64+
}
65+
66+
$ret = Add-BrokerMachinesToDesktopGroup @cmdArgs | Select-Object *
67+
$success = $true
68+
if($SRXEnv) {
69+
$SRXEnv.ResultMessage = $ret
70+
}
71+
else{
72+
Write-Output $ret
73+
}
74+
}
75+
catch{
76+
throw
77+
}
78+
finally{
79+
StopLogging -LoggingID $LogID -ServerAddress $SiteServer -IsSuccessful $success
80+
CloseCitrixSession
81+
}
+91
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Add the specified catalog/desktop group to the given scope
6+
7+
.DESCRIPTION
8+
9+
.NOTES
10+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
11+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
12+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
13+
the use and the consequences of the use of this freely available script.
14+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
15+
© ScriptRunner Software GmbH
16+
17+
.COMPONENT
18+
Requires the library script CitrixLibrary.ps1
19+
Requires PSSnapIn Citrix*
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/blob/master/Citrix/Administration
23+
24+
.Parameter SiteServer
25+
[sr-en] Specifies the address of a XenDesktop controller.
26+
This can be provided as a host name or an IP address
27+
[sr-de] Name oder IP Adresse des XenDesktop Controllers
28+
29+
.Parameter Scope
30+
[sr-en] scope(s) to add the object to, GUID or its name
31+
[sr-de] Name des Geltungsbereichs
32+
33+
.Parameter ApplicationGroup
34+
[sr-en] Application group to be added, Uid or name
35+
[sr-de] Uid oder Name der Anwendungsgruppe
36+
37+
.Parameter Catalog
38+
[sr-en] Catalog object to be added, Uid or name
39+
[sr-de] Uid oder Name des Maschinenkatalogs
40+
41+
.Parameter DesktopGroup
42+
[sr-en] Desktop group object to be added, Uid or name
43+
[sr-de] Uid oder Name der Bereitstellungsgruppe
44+
#>
45+
46+
param(
47+
[Parameter(Mandatory = $true)]
48+
[string]$Scope,
49+
[string]$ApplicationGroup,
50+
[string]$Catalog,
51+
[string]$DesktopGroup,
52+
[string]$SiteServer
53+
)
54+
55+
$LogID = $null
56+
[bool]$success = $false
57+
try{
58+
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
59+
StartLogging -ServerAddress $SiteServer -LogText "Add Scope $($Name)" -LoggingID ([ref]$LogID)
60+
61+
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
62+
'AdminAddress' = $SiteServer
63+
'LoggingID' = $LogID
64+
'InputObject' = $Scope
65+
}
66+
if($PSBoundParameters.ContainsKey('ApplicationGroup') -eq $true){
67+
$cmdArgs.Add('ApplicationGroup',$ApplicationGroup)
68+
}
69+
if($PSBoundParameters.ContainsKey('Catalog') -eq $true){
70+
$cmdArgs.Add('Catalog',$Catalog)
71+
}
72+
if($PSBoundParameters.ContainsKey('DesktopGroup') -eq $true){
73+
$cmdArgs.Add('DesktopGroup',$DesktopGroup)
74+
}
75+
76+
$ret = Add-BrokerScope @cmdArgs | Select-Object *
77+
$success = $true
78+
if($SRXEnv) {
79+
$SRXEnv.ResultMessage = $ret
80+
}
81+
else{
82+
Write-Output $ret
83+
}
84+
}
85+
catch{
86+
throw
87+
}
88+
finally{
89+
StopLogging -LoggingID $LogID -ServerAddress $SiteServer -IsSuccessful $success
90+
CloseCitrixSession
91+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Gets access policy rules
6+
7+
.DESCRIPTION
8+
9+
.NOTES
10+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
11+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
12+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
13+
the use and the consequences of the use of this freely available script.
14+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
15+
© ScriptRunner Software GmbH
16+
17+
.COMPONENT
18+
Requires the library script CitrixLibrary.ps1
19+
Requires PSSnapIn Citrix*
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/blob/master/Citrix/Policies
23+
24+
.Parameter SiteServer
25+
[sr-en] Specifies the address of a XenDesktop controller.
26+
This can be provided as a host name or an IP address
27+
[sr-de] Name oder IP Adresse des XenDesktop Controllers
28+
29+
.Parameter RuleName
30+
[sr-en] Name of the rule
31+
[sr-de] Name der Regel
32+
33+
.Parameter Uid
34+
[sr-en] Uid of the rule
35+
[sr-de] Uid der Regel
36+
37+
.Parameter Properties
38+
List of properties to expand. Use * for all properties
39+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
40+
#>
41+
42+
param(
43+
[string]$RuleName,
44+
[int]$Uid,
45+
[string]$SiteServer,
46+
[ValidateSet('*','AllowRestart','AllowedConnections','AllowedProtocols','AllowedUsers','Description','DesktopGroupName','DesktopGroupUid','Enabled','ExcludedClientIPFilterEnabled','ExcludedClientIPs','ExcludedClientNameFilterEnabled','ExcludedClientNames','ExcludedSmartAccessFilterEnabled','ExcludedSmartAccessTags','ExcludedUserFilterEnabled','ExcludedUsers','HdxSslEnabled',
47+
'IncludedClientIPFilterEnabled','IncludedClientIPs','IncludedClientNameFilterEnabled','IncludedClientNames','IncludedSmartAccessFilterEnabled','IncludedSmartAccessTags','IncludedUserFilterEnabled','IncludedUsers','MetadataMap','Name','Uid')]
48+
[string[]]$Properties = @('Name','Description','DesktopGroupUid','Enabled','AllowedUsers','ExcludedUsers','IncludedUsers')
49+
)
50+
51+
try{
52+
if($Properties -contains '*'){
53+
$Properties = @('*')
54+
}
55+
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
56+
57+
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
58+
'AdminAddress' = $SiteServer
59+
}
60+
61+
if($PSBoundParameters.ContainsKey('Uid') -eq $true){
62+
$cmdArgs.Add('Uid',$Uid)
63+
}
64+
elseif($PSBoundParameters.ContainsKey('RuleName') -eq $true){
65+
$cmdArgs.Add('Name',$RuleName)
66+
}
67+
68+
$ret = Get-BrokerAccessPolicyRule @cmdArgs | Select-Object $Properties
69+
if($SRXEnv) {
70+
$SRXEnv.ResultMessage = $ret
71+
}
72+
else{
73+
Write-Output $ret
74+
}
75+
}
76+
catch{
77+
throw
78+
}
79+
finally{
80+
CloseCitrixSession
81+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Gets access policy rule Metadata
6+
7+
.DESCRIPTION
8+
9+
.NOTES
10+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
11+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
12+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
13+
the use and the consequences of the use of this freely available script.
14+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
15+
© ScriptRunner Software GmbH
16+
17+
.COMPONENT
18+
Requires the library script CitrixLibrary.ps1
19+
Requires PSSnapIn Citrix*
20+
21+
.LINK
22+
https://github.com/scriptrunner/ActionPacks/blob/master/Citrix/Policies
23+
24+
.Parameter SiteServer
25+
[sr-en] Address of a XenDesktop controller.
26+
This can be provided as a host name or an IP address
27+
[sr-de] Name oder IP Adresse des XenDesktop Controllers
28+
29+
.Parameter RuleName
30+
[sr-en] Name of the rule
31+
[sr-de] Name der Regel
32+
33+
.Parameter RuleUid
34+
[sr-en] Uid of the rule
35+
[sr-de] Identifier der Regel
36+
#>
37+
38+
param(
39+
[Parameter(Mandatory = $true,ParameterSetName = 'ByName')]
40+
[string]$RuleName,
41+
[Parameter(Mandatory = $true,ParameterSetName = 'ById')]
42+
[string]$RuleUid,
43+
[Parameter(ParameterSetName = 'ByName')]
44+
[Parameter(ParameterSetName = 'ById')]
45+
[string]$SiteServer
46+
)
47+
48+
try{
49+
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
50+
51+
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
52+
'AdminAddress' = $SiteServer
53+
}
54+
55+
if($PSCmdlet.ParameterSetName -eq 'ByName'){
56+
$cmdArgs.Add('Name',$RuleName)
57+
}
58+
else{
59+
$cmdArgs.Add('Uid',$RuleUid)
60+
}
61+
62+
$ret = Get-BrokerAccessPolicyRule @cmdArgs | Select-Object -ExpandProperty MetadataMap
63+
if($SRXEnv) {
64+
$SRXEnv.ResultMessage = $ret
65+
}
66+
else{
67+
Write-Output $ret
68+
}
69+
}
70+
catch{
71+
throw
72+
}
73+
finally{
74+
CloseCitrixSession
75+
}

0 commit comments

Comments
 (0)