Skip to content

Commit 776bd1e

Browse files
New Action Pack Citrix
1 parent f4b63dd commit 776bd1e

File tree

186 files changed

+16199
-0
lines changed

Some content is hidden

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

186 files changed

+16199
-0
lines changed
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Grants a given right to the specified administrator
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 Role
30+
[sr-en] Role name or role identifier
31+
[sr-de] Name oder Identifier der Rolle
32+
33+
.Parameter Scope
34+
[sr-en] Scope name or scope identifier
35+
[sr-de] Name oder Identifier des Geltungsbereichs
36+
37+
.Parameter Administrator
38+
[sr-en] Name or SID of the administrator
39+
[sr-de] Name oder SID des Administrators
40+
41+
.Parameter All
42+
[sr-en] Specifies the 'All' scope
43+
[sr-de] Alle Geltungsbereiche
44+
#>
45+
46+
param(
47+
[Parameter(Mandatory = $true,ParameterSetName = 'ByScope')]
48+
[Parameter(Mandatory = $true,ParameterSetName = 'All')]
49+
[string]$Administrator,
50+
[Parameter(Mandatory = $true,ParameterSetName = 'ByScope')]
51+
[Parameter(Mandatory = $true,ParameterSetName = 'All')]
52+
[string]$Role,
53+
[Parameter(Mandatory = $true,ParameterSetName = 'ByScope')]
54+
[string]$Scope,
55+
[Parameter(Mandatory = $true,ParameterSetName = 'All')]
56+
[switch]$All,
57+
[Parameter(ParameterSetName = 'ByScope')]
58+
[Parameter(ParameterSetName = 'All')]
59+
[string]$SiteServer
60+
)
61+
62+
$LogID = $null
63+
[bool]$success = $false
64+
try{
65+
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
66+
StartLogging -ServerAddress $SiteServer -LogText "Add Admin right $($Administrator)" -LoggingID ([ref]$LogID)
67+
68+
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
69+
'AdminAddress' = $SiteServer
70+
'Role' = $Role
71+
'Administrator' = $Administrator
72+
}
73+
74+
if($PSCmdlet.ParameterSetName -eq 'All'){
75+
$cmdArgs.Add('All',$true)
76+
}
77+
else{
78+
$cmdArgs.Add('Scope',$Scope)
79+
}
80+
81+
$null = Add-AdminRight @cmdArgs
82+
$success = $true
83+
$ret = Get-AdminAdministrator -Name $Administrator -AdminAddress $SiteServer -ErrorAction Stop | Select-Object *
84+
if($SRXEnv) {
85+
$SRXEnv.ResultMessage = $ret
86+
}
87+
else{
88+
Write-Output $ret
89+
}
90+
}
91+
catch{
92+
throw
93+
}
94+
finally{
95+
StopLogging -LoggingID $LogID -ServerAddress $SiteServer -IsSuccessful $success
96+
CloseCitrixSession
97+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Gets the metadata from Administrator
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] 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 Name
30+
[sr-en] Name of the administrator
31+
[sr-de] Name des Administrators
32+
33+
.Parameter SID
34+
[sr-en] SID of the administrator
35+
[sr-de] SID des Administrators
36+
#>
37+
38+
param(
39+
[Parameter(Mandatory = $true,ParameterSetName = 'ByName')]
40+
[string]$Name,
41+
[Parameter(Mandatory = $true,ParameterSetName = 'ById')]
42+
[string]$SID,
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',$Name)
57+
}
58+
else{
59+
$cmdArgs.Add('Sid',$SID)
60+
}
61+
62+
$ret = Get-AdminAdministrator @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+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Gets administrators configured for this site
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 Name
30+
[sr-en] Administrators with the specified name
31+
[sr-de] Name der Administratoren
32+
Dieser Parameter unterstützt Wildcards am Anfang und/oder am Ende des Namens
33+
34+
.Parameter SID
35+
[sr-en] SID of the administrator
36+
[sr-de] SID des Administrators
37+
38+
.Parameter Enabled
39+
[sr-en] Administrators active or not
40+
[sr-de] Aktivierte Administratoren J/N
41+
42+
.Parameter UserIdentityType
43+
[sr-en] Administrators with the specified UserIdentityType
44+
[sr-de] Administratoren dieses UserIdentityType
45+
46+
.Parameter MaxRecordCount
47+
[sr-en] Maximum number of records to return
48+
[sr-de] Maximale Anzahl der Ergebnisse
49+
50+
.Parameter Properties
51+
List of properties to expand. Use * for all properties
52+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
53+
#>
54+
55+
param(
56+
[string]$SiteServer,
57+
[string]$Name,
58+
[string]$SID,
59+
[bool]$Enabled,
60+
[ValidateSet('SID,''CitrixCloudIdentity','CitrixMultiTenantServiceIdentity')]
61+
[string]$UserIdentityType,
62+
[int]$MaxRecordCount = 250,
63+
[ValidateSet('*','Name','Enabled','SID','Rights','BuiltIn','UserIdentityType','UserIdentity')]
64+
[string[]]$Properties = @('Name','Enabled','SID','Rights','UserIdentityType')
65+
)
66+
67+
try{
68+
StartCitrixSessionAdv -ServerName ([ref]$SiteServer)
69+
70+
[hashtable]$cmdArgs = @{'ErrorAction' = 'Stop'
71+
'AdminAddress' = $SiteServer
72+
'MaxRecordCount' = $MaxRecordCount
73+
}
74+
75+
if($PSBoundParameters.ContainsKey('Name') -eq $true){
76+
$cmdArgs.Add('Name',$Name)
77+
}
78+
if($PSBoundParameters.ContainsKey('SID') -eq $true){
79+
$cmdArgs.Add('SID',$SID)
80+
}
81+
if($PSBoundParameters.ContainsKey('Enabled') -eq $true){
82+
$cmdArgs.Add('Enabled',$Enabled)
83+
}
84+
if($PSBoundParameters.ContainsKey('UserIdentityType') -eq $true){
85+
$cmdArgs.Add('UserIdentityType',$UserIdentityType)
86+
}
87+
88+
$ret = Get-AdminAdministrator @cmdArgs | Select-Object $Properties
89+
if($SRXEnv) {
90+
$SRXEnv.ResultMessage = $ret
91+
}
92+
else{
93+
Write-Output $ret
94+
}
95+
}
96+
catch{
97+
throw
98+
}
99+
finally{
100+
CloseCitrixSession
101+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#Requires -Version 5.0
2+
3+
<#
4+
.SYNOPSIS
5+
Gets the metadata from the Controller
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] 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 ControllerName
30+
[sr-en] DNS name of the controller
31+
[sr-de] DNS Name des Controllers
32+
33+
.Parameter ControllerId
34+
[sr-en] UiD of the controller
35+
[sr-de] UiD des Controllers
36+
#>
37+
38+
param(
39+
[Parameter(Mandatory = $true,ParameterSetName = 'ByName')]
40+
[string]$ControllerName,
41+
[Parameter(Mandatory = $true,ParameterSetName = 'ById')]
42+
[string]$ControllerId,
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('DNSName',$ControllerName)
57+
}
58+
else{
59+
$cmdArgs.Add('Uid',$ControllerId)
60+
}
61+
62+
$ret = Get-BrokerController @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)