Skip to content

Commit 0473bc0

Browse files
New Action Pack DFS
1 parent 8525f3f commit 0473bc0

32 files changed

+2987
-2
lines changed

ActiveDirectory/Users/Set-ADUserPropertiesDemo.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ try{
301301
if($SRXEnv) {
302302
$SRXEnv.ResultMessage = "User $($Username) not found"
303303
}
304-
Throw "User $($Username) not found"
304+
throw "User $($Username) not found"
305305
}
306306
}
307307
catch{
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
#Requires -Version 5.0
2+
#requires -Modules DFSN
3+
4+
<#
5+
.SYNOPSIS
6+
Gets folder in a DFS namespace
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
20+
.LINK
21+
https://github.com/scriptrunner/ActionPacks/tree/master/WinFileManagement/DFS
22+
23+
.Parameter FolderPath
24+
[sr-en] Path of the DFS namespace folder, e.g. \\server\namespace\foldername
25+
You can use DFS namespace with the wildcard character
26+
[sr-de] Pfad des DFS-Namespace-Ordners, z.B. \\server\namespace\foldername
27+
Wildcard-Zeichen werden unterstützt
28+
29+
.Parameter Properties
30+
[sr-en] List of properties to expand. Use * for all properties
31+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
32+
33+
.Parameter ComputerName
34+
[sr-en] Name of the DFS computer
35+
[sr-de] DFS-Server
36+
37+
.Parameter AccessAccount
38+
[sr-en] User account that has permission to perform this action
39+
[sr-de] Ausreichend berechtigtes Benutzerkonto
40+
#>
41+
42+
[CmdLetBinding()]
43+
Param(
44+
[Parameter(Mandatory = $true)]
45+
[string]$FolderPath,
46+
[ValidateSet('Path','State','Description','NamespacePath','TimeToLive','Flags','PSComputerName')]
47+
[string[]]$Properties = @('Path','State','Description','NamespacePath'),
48+
[string]$ComputerName,
49+
[PSCredential]$AccessAccount
50+
)
51+
52+
Import-Module DFSN
53+
54+
$cimSes = $null
55+
try{
56+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
57+
if([System.String]::IsNullOrWhiteSpace($ComputerName) -eq $false){
58+
$cmdArgs.Add('ComputerName', $ComputerName)
59+
}
60+
if($null -ne $AccessAccount){
61+
$cmdArgs.Add('Credential', $AccessAccount)
62+
}
63+
$cimSes = New-CimSession @cmdArgs
64+
65+
$cmdArgs = @{ErrorAction = 'Stop'
66+
'Path' = $FolderPath
67+
'CimSession' = $cimSes
68+
}
69+
$objFolders = Get-DfsnFolder @cmdArgs | Sort-Object Path | Select-Object $Properties
70+
71+
if($null -ne $SRXEnv){
72+
$SRXEnv.ResultMessage = $objFolders
73+
}
74+
else{
75+
Write-Output $objFolders
76+
}
77+
}
78+
catch{
79+
throw
80+
}
81+
finally{
82+
if($null -ne $cimSes){
83+
Remove-CimSession $cimSes
84+
}
85+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#Requires -Version 5.0
2+
#requires -Modules DFSN
3+
4+
<#
5+
.SYNOPSIS
6+
Gets permissions for a DFS namespace folder
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
20+
.LINK
21+
https://github.com/scriptrunner/ActionPacks/tree/master/WinFileManagement/DFS
22+
23+
.Parameter FolderPath
24+
[sr-en] Path for a DFS namespace folder, e.g. \\server\namespace\foldername
25+
[sr-de] Pfad des DFS Namespace Ordners, z.B. \\server\namespace\foldername
26+
27+
.Parameter ComputerName
28+
[sr-en] Name of the DFS computer
29+
[sr-de] DFS-Server
30+
31+
.Parameter AccessAccount
32+
[sr-en] User account that has permission to perform this action
33+
[sr-de] Ausreichend berechtigtes Benutzerkonto
34+
#>
35+
36+
[CmdLetBinding()]
37+
Param(
38+
[Parameter(Mandatory = $true)]
39+
[string]$FolderPath,
40+
[string]$ComputerName,
41+
[PSCredential]$AccessAccount
42+
)
43+
44+
Import-Module DFSN
45+
46+
$cimSes = $null
47+
try{
48+
$Properties = @('AccountName','AccessType','Path','NamespacePath','PSComputerName')
49+
50+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
51+
if([System.String]::IsNullOrWhiteSpace($ComputerName) -eq $false){
52+
$cmdArgs.Add('ComputerName', $ComputerName)
53+
}
54+
if($null -ne $AccessAccount){
55+
$cmdArgs.Add('Credential', $AccessAccount)
56+
}
57+
$cimSes = New-CimSession @cmdArgs
58+
59+
$cmdArgs = @{ErrorAction = 'Stop'
60+
'Path' = $FolderPath
61+
'CimSession' = $cimSes
62+
}
63+
$objRights = Get-DfsnAccess @cmdArgs | Select-Object $Properties | Sort-Object AccountName
64+
65+
if($null -ne $SRXEnv){
66+
$SRXEnv.ResultMessage = $objRights
67+
}
68+
else{
69+
Write-Output $objRights
70+
}
71+
}
72+
catch{
73+
throw
74+
}
75+
finally{
76+
if($null -ne $cimSes){
77+
Remove-CimSession $cimSes
78+
}
79+
}
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#Requires -Version 5.0
2+
#requires -Modules DFSN
3+
4+
<#
5+
.SYNOPSIS
6+
Gets settings for targets of a DFS namespace folder
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
20+
.LINK
21+
https://github.com/scriptrunner/ActionPacks/tree/master/WinFileManagement/DFS
22+
23+
.Parameter FolderPath
24+
[sr-en] Path of the DFS namespace folder, e.g. \\server\namespace\foldername
25+
[sr-de] Pfad des DFS-Namespace-Ordners, z.B. \\server\namespace\foldername
26+
27+
.Parameter Properties
28+
List of properties to expand. Use * for all properties
29+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
30+
31+
.Parameter TargetPath
32+
[sr-en] Path for the target of a DFS namespace folder
33+
[sr-de] Zielordner mit Pfad
34+
35+
.Parameter ComputerName
36+
[sr-en] Name of the DFS computer
37+
[sr-de] DFS-Server
38+
39+
.Parameter AccessAccount
40+
[sr-en] User account that has permission to perform this action
41+
[sr-de] Ausreichend berechtigtes Benutzerkonto
42+
#>
43+
44+
[CmdLetBinding()]
45+
Param(
46+
[Parameter(Mandatory = $true)]
47+
[string]$FolderPath,
48+
[string]$TargetPath,
49+
[ValidateSet('Path','State','TargetPath','NamespacePath','ReferralPriorityClass','ReferralPriorityRank','PSComputerName')]
50+
[string[]]$Properties = @('Path','State','TargetPath','NamespacePath'),
51+
[string]$ComputerName,
52+
[PSCredential]$AccessAccount
53+
)
54+
55+
Import-Module DFSN
56+
57+
$cimSes = $null
58+
try{
59+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
60+
if([System.String]::IsNullOrWhiteSpace($ComputerName) -eq $false){
61+
$cmdArgs.Add('ComputerName', $ComputerName)
62+
}
63+
if($null -ne $AccessAccount){
64+
$cmdArgs.Add('Credential', $AccessAccount)
65+
}
66+
$cimSes = New-CimSession @cmdArgs
67+
68+
$cmdArgs = @{ErrorAction = 'Stop'
69+
'Path' = $FolderPath
70+
'CimSession' = $cimSes
71+
}
72+
if($PSBoundParameters.ContainsKey('TargetPath') -eq $true){
73+
$cmdArgs.Add('TargetPath',$TargetPath)
74+
}
75+
$objTargets = Get-DfsnFolderTarget @cmdArgs | Sort-Object Path | Select-Object $Properties
76+
77+
if($null -ne $SRXEnv){
78+
$SRXEnv.ResultMessage = $objTargets
79+
}
80+
else{
81+
Write-Output $objTargets
82+
}
83+
}
84+
catch{
85+
throw
86+
}
87+
finally{
88+
if($null -ne $cimSes){
89+
Remove-CimSession $cimSes
90+
}
91+
}

WinFileManagement/DFS/Get-DFSRoot.ps1

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
#Requires -Version 5.0
2+
#requires -Modules DFSN
3+
4+
<#
5+
.SYNOPSIS
6+
Gets settings for DFS namespaces
7+
8+
.DESCRIPTION
9+
10+
.NOTES
11+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
12+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
13+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
14+
the use and the consequences of the use of this freely available script.
15+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
16+
© ScriptRunner Software GmbH
17+
18+
.COMPONENT
19+
20+
.LINK
21+
https://github.com/scriptrunner/ActionPacks/tree/master/WinFileManagement/DFS
22+
23+
.Parameter Path
24+
[sr-en] Path for the root folder of a DFS namespace, e.g. \\server\namespace
25+
[sr-de] Pfad des DFS-Namespaces, z.B. \\server\namespace
26+
27+
.Parameter Servername
28+
[sr-en] Name of a server
29+
[sr-de] Servername
30+
31+
.Parameter ComputerName
32+
[sr-en] Name of the DFS computer
33+
[sr-de] DFS-Server
34+
35+
.Parameter AccessAccount
36+
[sr-en] User account that has permission to perform this action
37+
[sr-de] Ausreichend berechtigtes Benutzerkonto
38+
#>
39+
40+
[CmdLetBinding()]
41+
Param(
42+
[Parameter(Mandatory = $true,ParameterSetName = 'ServerName')]
43+
[string]$ServerName,
44+
[Parameter(Mandatory = $true,ParameterSetName = 'ByPath')]
45+
[string]$Path,
46+
[Parameter(ParameterSetName = 'ServerName')]
47+
[Parameter(ParameterSetName = 'ByPath')]
48+
[string]$ComputerName,
49+
[Parameter(ParameterSetName = 'ServerName')]
50+
[Parameter(ParameterSetName = 'ByPath')]
51+
[PSCredential]$AccessAccount
52+
)
53+
54+
Import-Module DFSN
55+
56+
$cimSes = $null
57+
try{
58+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
59+
if([System.String]::IsNullOrWhiteSpace($ComputerName) -eq $false){
60+
$cmdArgs.Add('ComputerName', $ComputerName)
61+
}
62+
if($null -ne $AccessAccount){
63+
$cmdArgs.Add('Credential', $AccessAccount)
64+
}
65+
$cimSes = New-CimSession @cmdArgs
66+
67+
$cmdArgs = @{ErrorAction = 'Stop'
68+
'CimSession' = $cimSes
69+
}
70+
if($PSCmdlet.ParameterSetName -eq 'ServerName'){
71+
$cmdArgs.Add('Computername',$ServerName)
72+
}
73+
else{
74+
if($PSBoundParameters.ContainsKey('Path') -eq $true){
75+
$cmdArgs.Add('Path',$Path)
76+
}
77+
}
78+
$objRoot = Get-DfsnRoot @cmdArgs | Sort-Object Path | Select-Object *
79+
80+
if($null -ne $SRXEnv){
81+
$SRXEnv.ResultMessage = $objRoot
82+
}
83+
else{
84+
Write-Output $objRoot
85+
}
86+
}
87+
catch{
88+
throw
89+
}
90+
finally{
91+
if($null -ne $cimSes){
92+
Remove-CimSession $cimSes
93+
}
94+
}

0 commit comments

Comments
 (0)