Skip to content

Commit 2c56435

Browse files
Group scripts
1 parent 9485434 commit 2c56435

25 files changed

+1802
-0
lines changed

MS Graph/Groups/Get-MGGGroup.ps1

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Groups
3+
4+
<#
5+
.SYNOPSIS
6+
Returns a group
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+
Requires Library script MS Graph\_LIB_\MGLibrary
20+
Requires Modules Microsoft.Graph.Groups
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Groups
24+
25+
.Parameter GroupId
26+
[sr-en] Group identifier
27+
[sr-de] Gruppen ID
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+
34+
param(
35+
[string]$GroupId,
36+
[ValidateSet('AcceptedSenders','CreatedDateTime','DeletedDateTime','Description','DisplayName','Id','IsArchived','Mail','MailEnabled','MailNickname','MemberOf','Members','Owners','Specialization','Visibility','GroupTypes','PreferredLanguage','ProxyAddresses','RenewedDateTime','SecurityEnabled','SecurityIdentifier')]
37+
[string[]]$Properties = @('DisplayName','Id','Description','CreatedDateTime','Mail','MailEnabled')
38+
)
39+
40+
Import-Module Microsoft.Graph.Groups
41+
42+
try{
43+
ConnectMSGraph
44+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
45+
if($PSBoundParameters.ContainsKey('GroupID') -eq $true){
46+
$cmdArgs.Add('GroupId',$GroupId)
47+
}
48+
else{
49+
$cmdArgs.Add('All',$null)
50+
$cmdArgs.Add('Sort','DisplayName')
51+
}
52+
$mgGroup = Get-MgGroup @cmdArgs | Select-Object $Properties
53+
54+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
55+
ConvertTo-ResultHtml -Result $mgGroup
56+
}
57+
if($SRXEnv) {
58+
$SRXEnv.ResultMessage = $mgGroup
59+
}
60+
else{
61+
Write-Output $mgGroup
62+
}
63+
}
64+
catch{
65+
throw
66+
}
67+
finally{
68+
DisconnectMSGraph
69+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Groups
3+
4+
<#
5+
.SYNOPSIS
6+
Gets a list of users or groups that are allowed to create post's or calendar events in this group
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+
Requires Library script MS Graph\_LIB_\MGLibrary
20+
Requires Modules Microsoft.Graph.Groups
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Groups
24+
25+
.Parameter GroupId
26+
[sr-en] Group identifier
27+
[sr-de] Gruppen ID
28+
#>
29+
30+
param(
31+
[Parameter(Mandatory = $true)]
32+
[string]$GroupId
33+
)
34+
35+
Import-Module Microsoft.Graph.Groups
36+
37+
try{
38+
ConnectMSGraph
39+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
40+
'GroupId'= $GroupId
41+
}
42+
$result = Get-MgGroupAcceptedSender @cmdArgs | Select-Object *
43+
44+
if($SRXEnv) {
45+
$SRXEnv.ResultMessage = $result
46+
}
47+
else{
48+
Write-Output $result
49+
}
50+
}
51+
catch{
52+
throw
53+
}
54+
finally{
55+
DisconnectMSGraph
56+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Groups
3+
4+
<#
5+
.SYNOPSIS
6+
Gets a collection of open extensions defined for the group
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+
Requires Library script MS Graph\_LIB_\MGLibrary
20+
Requires Modules Microsoft.Graph.Groups
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Groups
24+
25+
.Parameter GroupId
26+
[sr-en] Group identifier
27+
[sr-de] Gruppen ID
28+
#>
29+
30+
param(
31+
[Parameter(Mandatory = $true)]
32+
[string]$GroupId
33+
)
34+
35+
Import-Module Microsoft.Graph.Groups
36+
37+
try{
38+
ConnectMSGraph
39+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
40+
'GroupId'= $GroupId
41+
'All' = $null
42+
}
43+
$result = Get-MgGroupExtension @cmdArgs | Select-Object *
44+
45+
if($SRXEnv) {
46+
$SRXEnv.ResultMessage = $result
47+
}
48+
else{
49+
Write-Output $result
50+
}
51+
}
52+
catch{
53+
throw
54+
}
55+
finally{
56+
DisconnectMSGraph
57+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Groups
3+
4+
<#
5+
.SYNOPSIS
6+
Get entity from groupLifecyclePolicies by key
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+
Requires Library script MS Graph\_LIB_\MGLibrary
20+
Requires Modules Microsoft.Graph.Groups
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Groups
24+
25+
.Parameter GroupLifecyclePolicyId
26+
[sr-en] Id of groupLifecyclePolicy
27+
[sr-de] ID der groupLifecyclePolicy
28+
#>
29+
30+
param(
31+
[string]$GroupLifecyclePolicyId
32+
)
33+
34+
Import-Module Microsoft.Graph.Groups
35+
36+
try{
37+
ConnectMSGraph
38+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
39+
if($PSBoundParameters.ContainsKey('GroupLifecyclePolicyId') -eq $true){
40+
$cmdArgs.Add('GroupLifecyclePolicyId',$GroupLifecyclePolicyId)
41+
}
42+
else {
43+
$cmdArgs.Add('All',$null)
44+
}
45+
$result = Get-MgGroupLifecyclePolicy @cmdArgs | Select-Object *
46+
47+
if($SRXEnv) {
48+
$SRXEnv.ResultMessage = $result
49+
}
50+
else{
51+
Write-Output $result
52+
}
53+
}
54+
catch{
55+
throw
56+
}
57+
finally{
58+
DisconnectMSGraph
59+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Groups
3+
4+
<#
5+
.SYNOPSIS
6+
Returns members from a group
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+
Requires Library script MS Graph\_LIB_\MGLibrary
20+
Requires Modules Microsoft.Graph.Groups
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Groups
24+
25+
.Parameter GroupId
26+
[sr-en] Group identifier
27+
[sr-de] Gruppen ID
28+
#>
29+
30+
param(
31+
[Parameter(Mandatory = $true)]
32+
[string]$GroupId
33+
)
34+
35+
Import-Module Microsoft.Graph.Groups
36+
37+
try{
38+
$result = $null
39+
GetGroupMembers -GroupID $GroupId -Memberships ([ref]$result)
40+
41+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
42+
ConvertTo-ResultHtml -Result $result
43+
}
44+
if($SRXEnv) {
45+
$SRXEnv.ResultMessage = $result
46+
}
47+
else{
48+
Write-Output $result
49+
}
50+
}
51+
catch{
52+
throw
53+
}
54+
finally{
55+
}
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Groups
3+
4+
<#
5+
.SYNOPSIS
6+
Returns groups that this group is a member of
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+
Requires Library script MS Graph\_LIB_\MGLibrary
20+
Requires Modules Microsoft.Graph.Groups
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Groups
24+
25+
.Parameter GroupId
26+
[sr-en] Group identifier
27+
[sr-de] Gruppen ID
28+
#>
29+
30+
param(
31+
[Parameter(Mandatory = $true)]
32+
[string]$GroupId
33+
)
34+
35+
Import-Module Microsoft.Graph.Groups
36+
37+
try{
38+
ConnectMSGraph
39+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
40+
'GroupId'= $GroupId
41+
'All' = $null
42+
}
43+
$mships = Get-MgGroupMemberof @cmdArgs | Select-Object *
44+
45+
[PSCustomObject]$result = @()
46+
# memberships
47+
foreach($itm in $mships){
48+
[PSCustomObject]$ship = [PSCustomObject] @{DisplayName='';MailNickname='';Type=''}
49+
if($itm.AdditionalProperties.ContainsKey('@odata.type')){
50+
$ship.Type = $itm.AdditionalProperties.Item('@odata.type').Replace('#microsoft.graph.','')
51+
}
52+
if($itm.AdditionalProperties.ContainsKey('displayName')){
53+
$ship.DisplayName = $itm.AdditionalProperties.displayName
54+
}
55+
if($itm.AdditionalProperties.ContainsKey('mailNickname')){
56+
$ship.MailNickname = $itm.AdditionalProperties.mailnickname
57+
}
58+
$result += $ship
59+
}
60+
$result = $result | Sort-Object DisplayName
61+
62+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
63+
ConvertTo-ResultHtml -Result $result
64+
}
65+
if($SRXEnv) {
66+
$SRXEnv.ResultMessage = $result
67+
}
68+
else{
69+
Write-Output $result
70+
}
71+
}
72+
catch{
73+
throw
74+
}
75+
finally{
76+
DisconnectMSGraph
77+
}

0 commit comments

Comments
 (0)