Skip to content

Commit 3f945af

Browse files
Merge commit '59ddf7b574820384ce4d47f0c2342567184e1418' into master
2 parents 2c56435 + 59ddf7b commit 3f945af

Some content is hidden

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

45 files changed

+3450
-0
lines changed

MS Graph/Users/Get-MGUUser.ps1

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Returns a user
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 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]$UserId,
36+
[ValidateSet('AboutMe','AccountEnabled','AssignedLicenses','Birthday','BusinessPhones','City','CompanyName','Country','CreatedDateTime','DeletedDateTime','Department','DisplayName',
37+
'EmployeeId','EmployeeType','FaxNumber','GivenName','HireDate','Id','Interests','IsResourceAccount','JobTitle','LastPasswordChangeDateTime','LicenseDetails','Mail','MailNickname',
38+
'Manager','MemberOf','MobilePhone','OfficeLocation','OtherMails','PostalCode','PreferredLanguage','PreferredName','Schools','ShowInAddressList','Skills','State','StreetAddress','Surname','UserPrincipalName','UserType')]
39+
[string[]]$Properties = @('DisplayName','Id','GivenName','Surname','Mail','PostalCode','City','StreetAddress','CompanyName','Country','Department','AccountEnabled','LastPasswordChangeDateTime','CreatedDateTime','DeletedDateTime')
40+
)
41+
42+
Import-Module Microsoft.Graph.Users
43+
44+
try{
45+
ConnectMSGraph
46+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'}
47+
if($PSBoundParameters.ContainsKey('UserId') -eq $true){
48+
$cmdArgs.Add('UserId',$UserId)
49+
}
50+
else{
51+
$cmdArgs.Add('All',$null)
52+
$cmdArgs.Add('Sort','DisplayName')
53+
}
54+
$result = Get-MgUser @cmdArgs | Select-Object $Properties
55+
56+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
57+
ConvertTo-ResultHtml -Result $result
58+
}
59+
if($SRXEnv) {
60+
$SRXEnv.ResultMessage = $result
61+
}
62+
else{
63+
Write-Output $result
64+
}
65+
}
66+
catch{
67+
throw
68+
}
69+
finally{
70+
DisconnectMSGraph
71+
}
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+
Returns directory objects that were created by the use
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+
'All' = $null
42+
}
43+
$result = Get-MgUserCreatedObject @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: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Returns users and contacts that report to the user
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+
'All' = $null
42+
}
43+
$result = Get-MgUserDirectReport @cmdArgs
44+
45+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
46+
ConvertTo-ResultHtml -Result $result
47+
}
48+
if($SRXEnv) {
49+
$SRXEnv.ResultMessage = $result
50+
}
51+
else{
52+
Write-Output $result
53+
}
54+
}
55+
catch{
56+
throw
57+
}
58+
finally{
59+
DisconnectMSGraph
60+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Returns a collection of open extensions defined for the user
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+
'All' = $null
42+
}
43+
$result = Get-MgUserExtension @cmdArgs
44+
45+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
46+
ConvertTo-ResultHtml -Result $result
47+
}
48+
if($SRXEnv) {
49+
$SRXEnv.ResultMessage = $result
50+
}
51+
else{
52+
Write-Output $result
53+
}
54+
}
55+
catch{
56+
throw
57+
}
58+
finally{
59+
DisconnectMSGraph
60+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Returns collection of this user's license details
7+
8+
.DESCRIPTION
9+
10+
11+
.NOTES
12+
This PowerShell script was developed and optimized for ScriptRunner. The use of the scripts requires ScriptRunner.
13+
The customer or user is authorized to copy the script from the repository and use them in ScriptRunner.
14+
The terms of use for ScriptRunner do not apply to this script. In particular, ScriptRunner Software GmbH assumes no liability for the function,
15+
the use and the consequences of the use of this freely available script.
16+
PowerShell is a product of Microsoft Corporation. ScriptRunner is a product of ScriptRunner Software GmbH.
17+
© ScriptRunner Software GmbH
18+
19+
.COMPONENT
20+
Requires Library script MS Graph\_LIB_\MGLibrary
21+
Requires Modules Microsoft.Graph.Users
22+
23+
.LINK
24+
https://github.com/scriptrunner/ActionPacks/tree/master/MS%20Graph/Users
25+
26+
.Parameter UserId
27+
[sr-en] User identifier
28+
[sr-de] Benutzer ID
29+
#>
30+
31+
param(
32+
[Parameter(Mandatory = $true)]
33+
[string]$UserId
34+
)
35+
36+
Import-Module Microsoft.Graph.Users
37+
38+
try{
39+
ConnectMSGraph
40+
[hashtable]$cmdArgs = @{ErrorAction = 'Stop'
41+
'UserId'= $UserId
42+
'All' = $null
43+
}
44+
$result = Get-MgUserLicenseDetail @cmdArgs | Select-Object *
45+
46+
if (Get-Command 'ConvertTo-ResultHtml' -ErrorAction Ignore) {
47+
ConvertTo-ResultHtml -Result $result
48+
}
49+
if($SRXEnv) {
50+
$SRXEnv.ResultMessage = $result
51+
}
52+
else{
53+
Write-Output $result
54+
}
55+
}
56+
catch{
57+
throw
58+
}
59+
finally{
60+
DisconnectMSGraph
61+
}

MS Graph/Users/Get-MGUUserManager.ps1

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
#Requires -Version 5.0
2+
#requires -Modules Microsoft.Graph.Users
3+
4+
<#
5+
.SYNOPSIS
6+
Returns user or contact that is this user's manager
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+
}
42+
$result = Get-MgUserManager @cmdArgs
43+
if($null -ne $result){
44+
$cmdArgs.UserId = $result.Id
45+
$result = Get-MgUser @cmdArgs | Select-Object @('DisplayName','Id','GivenName','Surname','Mail')
46+
}
47+
48+
if($SRXEnv) {
49+
$SRXEnv.ResultMessage = $result
50+
}
51+
else{
52+
Write-Output $result
53+
}
54+
}
55+
catch{
56+
throw
57+
}
58+
finally{
59+
DisconnectMSGraph
60+
}

0 commit comments

Comments
 (0)