Skip to content

Commit 93e65a6

Browse files
Graph Users v2.1
1 parent 7aedc51 commit 93e65a6

File tree

64 files changed

+1607
-186
lines changed

Some content is hidden

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

64 files changed

+1607
-186
lines changed

MS Graph/Users/Get-MGUUser.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<#
55
.SYNOPSIS
6-
Returns a user
6+
Retrieve the properties and relationships of user object
77
88
.DESCRIPTION
99

MS Graph/Users/Get-MGUUserCount.ps1

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Get the number of the resource
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.Users
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Users
24+
#>
25+
26+
param(
27+
)
28+
29+
Import-Module Microsoft.Graph.Users
30+
31+
try{
32+
ConnectMSGraph
33+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
34+
$result = Get-MgUserCount -ConsistencyLevel eventual @cmdArgs | Select-Object $Properties
35+
36+
if($SRXEnv) {
37+
$SRXEnv.ResultMessage = $result
38+
}
39+
else{
40+
Write-Output $result
41+
}
42+
}
43+
catch{
44+
throw
45+
}
46+
finally{
47+
DisconnectMSGraph
48+
}

MS Graph/Users/Get-MGUUserCreatedObject.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<#
55
.SYNOPSIS
6-
Returns directory objects that were created by the use
6+
Returns directory objects that were created by the user
77
88
.DESCRIPTION
99
@@ -32,7 +32,7 @@ param(
3232
[string]$UserId
3333
)
3434

35-
Import-Module Microsoft.Graph.Users
35+
Import-Module Microsoft.Graph.Users
3636

3737
try{
3838
ConnectMSGraph

MS Graph/Users/Get-MGUUserDirectReport.ps1 renamed to MS Graph/Users/Get-MGUUserDirectReportAsUser.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ try{
4040
'UserId'= $UserId
4141
'All' = $null
4242
}
43-
$result = Get-MgUserDirectReport @cmdArgs
43+
$result = Get-MgUserDirectReportAsUser @cmdArgs
4444

4545
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
4646
ConvertTo-ResultHtml -Result $result
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.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Get the number of the resource
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.Users
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Users
24+
25+
.Parameter UserId
26+
[sr-en] User identifier
27+
[sr-de] Benutzer ID
28+
#>
29+
30+
param(
31+
[Parameter(Mandatory = $true)]
32+
[string]$UserId
33+
)
34+
35+
Import-Module Microsoft.Graph.Users
36+
37+
try{
38+
ConnectMSGraph
39+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
40+
'UserId'= $UserId
41+
'ConsistencyLevel' = 'eventual'
42+
}
43+
$result = Get-MgUserDirectReportCount @cmdArgs
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+
}

MS Graph/Users/Get-MGUUserExtension.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<#
55
.SYNOPSIS
6-
Returns a collection of open extensions defined for the user
6+
Returns a collection of open extensions defined for the user
77
88
.DESCRIPTION
99
@@ -40,7 +40,7 @@ try{
4040
'UserId'= $UserId
4141
'All' = $null
4242
}
43-
$result = Get-MgUserExtension @cmdArgs
43+
$result = Get-MgUserExtension @cmdArgs | Select-Object *
4444

4545
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
4646
ConvertTo-ResultHtml -Result $result

MS Graph/Users/Get-MGUUserManager.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<#
55
.SYNOPSIS
6-
Returns user or contact that is this user's manager
6+
Returns user or contact that is this user's manager
77
88
.DESCRIPTION
99

MS Graph/Users/Get-MGUUserMemberOf.ps1

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,16 @@
2525
.Parameter UserId
2626
[sr-en] User identifier
2727
[sr-de] Benutzer ID
28+
29+
.PARAMETER Transitive
30+
[sr-en] Groups, including nested groups, and directory roles that a user is a member of
31+
[sr-de] Gruppen, einschließlich verschachtelter Gruppen, und Verzeichnisrollen, in denen ein Benutzer Mitglied ist
2832
#>
2933

3034
param(
3135
[Parameter(Mandatory = $true)]
32-
[string]$UserId
36+
[string]$UserId,
37+
[switch]$Transitive
3338
)
3439

3540
Import-Module Microsoft.Graph.Users
@@ -40,7 +45,12 @@ try{
4045
'UserId'= $UserId
4146
'All' = $null
4247
}
43-
$mships = Get-MgUserMemberof @cmdArgs | Select-Object *
48+
if($Transitive.IsPresent -eq $true){
49+
$mships = Get-MgUserTransitiveMemberOf @cmdArgs | Select-Object *
50+
}
51+
else{
52+
$mships = Get-MgUserMemberOf @cmdArgs | Select-Object *
53+
}
4454

4555
[PSCustomObject]$result = @()
4656
# memberships
@@ -73,5 +83,5 @@ catch{
7383
throw
7484
}
7585
finally{
76-
DisconnectMSGraph
86+
DisconnectMSGraph
7787
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Get the number of the resource
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.Users
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Users
24+
25+
.Parameter UserId
26+
[sr-en] User identifier
27+
[sr-de] Benutzer ID
28+
29+
.PARAMETER Transitive
30+
[sr-en] Transitive
31+
[sr-de]
32+
#>
33+
34+
param(
35+
[Parameter(Mandatory = $true)]
36+
[string]$UserId,
37+
[switch]$Transitive
38+
)
39+
40+
Import-Module Microsoft.Graph.Users
41+
42+
try{
43+
ConnectMSGraph
44+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
45+
'UserId'= $UserId
46+
'ConsistencyLevel' = 'eventual'
47+
}
48+
if($Transitive.IsPresent -eq $true){
49+
$mships = Get-MgUserTransitiveMemberOfCount @cmdArgs | Select-Object *
50+
}
51+
else{
52+
$mships = Get-MgUserMemberOfCount @cmdArgs | Select-Object *
53+
}
54+
55+
if($SRXEnv) {
56+
$SRXEnv.ResultMessage = $mships
57+
}
58+
else{
59+
Write-Output $mships
60+
}
61+
}
62+
catch{
63+
throw
64+
}
65+
finally{
66+
DisconnectMSGraph
67+
}

MS Graph/Users/Get-MGUUserOAuthPermissionGrant.ps1

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<#
55
.SYNOPSIS
6-
Returns oauth2PermissionGrants from users
6+
Get oauth2PermissionGrants from users
77
88
.DESCRIPTION
99
@@ -25,20 +25,30 @@
2525
.Parameter UserId
2626
[sr-en] User identifier
2727
[sr-de] Benutzer ID
28+
29+
.Parameter OAuth2PermissionGrantId
30+
[sr-en] Unique identifier of oAuth2PermissionGrant
31+
[sr-de] Eindeutige ID des oAuth2PermissionGrant
2832
#>
2933

3034
param(
3135
[Parameter(Mandatory = $true)]
32-
[string]$UserId
36+
[string]$UserId,
37+
[string]$OAuth2PermissionGrantId
3338
)
3439

3540
Import-Module Microsoft.Graph.Users
3641

3742
try{
3843
ConnectMSGraph
3944
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
40-
'UserId'= $UserId
41-
'All' = $null
45+
'UserId'= $UserId
46+
}
47+
if($PSBoundParameters.ContainsKey('OAuth2PermissionGrantId') -eq $true){
48+
$cmdArgs.Add('OAuth2PermissionGrantId',$OAuth2PermissionGrantId)
49+
}
50+
else{
51+
$cmdArgs.Add('All',$null)
4252
}
4353
$result = Get-MgUserOauth2PermissionGrant @cmdArgs | Select-Object *
4454

0 commit comments

Comments
 (0)