Skip to content

Commit 6aac39b

Browse files
Reports Action Pack MSOnline
1 parent 43c512f commit 6aac39b

File tree

6 files changed

+386
-1
lines changed

6 files changed

+386
-1
lines changed

O365/AzureAD/_REPORTS_/Get-AADGroupMembers_Html.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ try{
9090
}
9191

9292
if($null -ne $Script:Members){
93-
$Script:Members
9493
ConvertTo-ResultHtml -Result $Script:Members
9594
}
9695
else {
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
#Requires -Version 4.0
2+
#Requires -Modules MSOnline
3+
4+
<#
5+
.SYNOPSIS
6+
Generates a report with the members from the Azure Active Directory 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+
Azure Active Directory Powershell Module v1
20+
Requires Library Script ReportLibrary from the Action Pack Reporting\_LIB_
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/O365/MSOnline/_REPORTS_
24+
25+
.Parameter GroupObjectId
26+
[sr-en] Specifies the unique ID of the group from which to get members
27+
[sr-de] Gibt die eindeutige ID der Gruppe an
28+
29+
.Parameter GroupName
30+
[sr-en] Specifies the display name of the group from which to get members
31+
[sr-de] Gibt den Namen der Gruppe an
32+
33+
.Parameter Nested
34+
[sr-en] Shows group members nested
35+
[sr-de] Gruppenmitglieder rekursiv anzeigen
36+
37+
.Parameter MemberObjectTypes
38+
[sr-en] Specifies the member object types
39+
[sr-de] Gruppen, Benutzer oder alle anzeigen
40+
41+
.Parameter TenantId
42+
[sr-en] Specifies the unique ID of a tenant
43+
[sr-de] Die eindeutige ID eines Mandanten
44+
#>
45+
46+
param(
47+
[Parameter(Mandatory = $true,ParameterSetName = "Group object id")]
48+
[guid]$GroupObjectId,
49+
[Parameter(Mandatory = $true,ParameterSetName = "Group name")]
50+
[string]$GroupName,
51+
[Parameter(ParameterSetName = "Group name")]
52+
[Parameter(ParameterSetName = "Group object id")]
53+
[switch]$Nested,
54+
[Parameter(ParameterSetName = "Group name")]
55+
[Parameter(ParameterSetName = "Group object id")]
56+
[ValidateSet('All','Users', 'Groups')]
57+
[string]$MemberObjectTypes='All',
58+
[Parameter(ParameterSetName = "Group name")]
59+
[Parameter(ParameterSetName = "Group object id")]
60+
[guid]$TenantId
61+
)
62+
63+
try{
64+
$Script:Members=@()
65+
66+
function Get-NestedGroupMember($group) {
67+
$Script:Members += [PSCustomObject] @{Type = 'Group';DisplayName = $group.DisplayName }
68+
if(($MemberObjectTypes -eq 'All' ) -or ($MemberObjectTypes -eq 'Users')){
69+
Get-MsolGroupMember -GroupObjectId $group.ObjectId -MemberObjectTypes 'User' -TenantId $TenantId | `
70+
Sort-Object -Property DisplayName | ForEach-Object{
71+
$Script:Members += [PSCustomObject] @{Type = 'User';DisplayName = $_.DisplayName }
72+
}
73+
}
74+
if(($MemberObjectTypes -eq 'All' ) -or ($MemberObjectTypes -eq 'Groups')){
75+
Get-MsolGroupMember -GroupObjectId $group.ObjectId -MemberObjectTypes 'Group' -TenantId $TenantId | `
76+
Sort-Object -Property DisplayName | ForEach-Object{
77+
if($Nested -eq $true){
78+
Get-NestedGroupMember $_
79+
}
80+
else {
81+
$Script:Members += [PSCustomObject] @{Type = 'Group';DisplayName = $_.DisplayName }
82+
}
83+
}
84+
}
85+
}
86+
87+
if($PSCmdlet.ParameterSetName -eq "Group object id"){
88+
$Script:Grp = Get-MsolGroup -ObjectId $GroupObjectId -TenantId $TenantId
89+
}
90+
else{
91+
$Script:Grp = Get-MsolGroup -TenantId $TenantId | Where-Object {$_.Displayname -eq $GroupName}
92+
}
93+
if($null -ne $Script:Grp){
94+
Get-NestedGroupMember $Script:Grp
95+
}
96+
else {
97+
if($SRXEnv) {
98+
$SRXEnv.ResultMessage = "Group not found"
99+
}
100+
Throw "Group not found"
101+
}
102+
103+
if($null -ne $Script:Members){
104+
ConvertTo-ResultHtml -Result $Script:Members
105+
}
106+
else {
107+
if($SRXEnv) {
108+
$SRXEnv.ResultMessage = "No members found"
109+
}
110+
else{
111+
Write-Output "No members found"
112+
}
113+
}
114+
}
115+
catch{
116+
throw
117+
}
Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#Requires -Version 4.0
2+
#Requires -Modules MSOnline
3+
4+
<#
5+
.SYNOPSIS
6+
Generates a report with the groups from Azure Active Directory<<
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+
Azure Active Directory Powershell Module v1
20+
Requires Library Script ReportLibrary from the Action Pack Reporting\_LIB_
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/O365/MSOnline/_REPORTS_
24+
25+
.Parameter IsAgentRole
26+
[sr-en] Specifies that this cmdlet returns only agent groups. This value applies only to partner users
27+
[sr-de] Nur Agentengruppen
28+
29+
.Parameter HasLicenseErrorsOnly
30+
[sr-en] Specifies whether this cmdlet returns only security groups that have license errors
31+
[sr-de] Nur Sicherheitsgruppen mit Lizenzfehlern
32+
33+
.Parameter HasErrorsOnly
34+
[sr-en] Indicates that this cmdlet returns only groups that have validation errors
35+
[sr-de] Nur Gruppen mit Validierungsfehlern
36+
37+
.Parameter GroupType
38+
[sr-en] Specifies the type of groups to get
39+
[sr-de] Gibt den Typ der Gruppen an
40+
41+
.Parameter TenantId
42+
[sr-en] Specifies the unique ID of a tenant
43+
[sr-de] Die eindeutige ID eines Mandanten
44+
#>
45+
46+
param(
47+
[switch]$IsAgentRole,
48+
[switch]$HasLicenseErrorsOnly,
49+
[switch]$HasErrorsOnly,
50+
[ValidateSet('All','Security', 'MailEnabledSecurity','DistributionList')]
51+
[string]$GroupType='All',
52+
[guid]$TenantId
53+
)
54+
55+
try{
56+
[string[]]$Properties = @('DisplayName','Description','EmailAddress','GroupType','IsSystem','ValidationStatus','CommonName','ObjectID')
57+
if ($IsAgentRole -eq $true) {
58+
if([System.String]::IsNullOrWhiteSpace($GroupType -or $GroupType -eq 'All')){
59+
$Script:Grps = Get-MsolGroup -HasLicenseErrorsOnly:$HasLicenseErrorsOnly.ToBool() -HasErrorsOnly:$HasErrorsOnly -TenantId $TenantId -IsAgentRole
60+
}
61+
else {
62+
$Script:Grps = Get-MsolGroup -HasLicenseErrorsOnly:$HasLicenseErrorsOnly.ToBool() -HasErrorsOnly:$HasErrorsOnly -GroupType $GroupType -TenantId $TenantId -IsAgentRole
63+
}
64+
}
65+
else {
66+
if([System.String]::IsNullOrWhiteSpace($GroupType) -or $GroupType -eq 'All'){
67+
$Script:Grps = Get-MsolGroup -HasLicenseErrorsOnly:$HasLicenseErrorsOnly.ToBool() -HasErrorsOnly:$HasErrorsOnly -TenantId $TenantId
68+
}
69+
else {
70+
$Script:Grps = Get-MsolGroup -HasLicenseErrorsOnly:$HasLicenseErrorsOnly.ToBool() -HasErrorsOnly:$HasErrorsOnly -GroupType $GroupType -TenantId $TenantId
71+
}
72+
}
73+
if($null -ne $Script:Grps){
74+
ConvertTo-ResultHtml -Result ($Script:Grps | Select-Object $Properties | Sort-Object -Property DisplayName)
75+
}
76+
else {
77+
if($SRXEnv) {
78+
$SRXEnv.ResultMessage = "No groups found"
79+
}
80+
else{
81+
Write-Output "No groups found"
82+
}
83+
}
84+
}
85+
catch{
86+
throw
87+
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#Requires -Version 4.0
2+
#Requires -Modules MSOnline
3+
4+
<#
5+
.SYNOPSIS
6+
Generates a report with the properties of the users
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+
Azure Active Directory Powershell Module v1
20+
Requires Library Script ReportLibrary from the Action Pack Reporting\_LIB_
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/O365/MSOnline/_REPORTS_
24+
25+
.Parameter UserObjectId
26+
[sr-en] Specifies the unique ID of the user
27+
[sr-de] Gibt die eindeutige ID des Benutzers an
28+
29+
.Parameter UserName
30+
[sr-en] Specifies the Display name, Sign-In Name or user principal name of the user from which to get properties
31+
[sr-de] Gibt den Anzeigenamen, Anmeldenamen oder UPN des Benutzers an
32+
33+
.Parameter Properties
34+
[sr-en] List of properties to expand. Use * for all properties
35+
[sr-de] Liste der zu anzuzeigenden Eigenschaften. Verwenden Sie * für alle Eigenschaften
36+
37+
.Parameter TenantId
38+
[sr-en] Specifies the unique ID of a tenant
39+
[sr-de] Die eindeutige ID eines Mandanten
40+
#>
41+
42+
param(
43+
[Parameter(Mandatory = $true,ParameterSetName = "User object id")]
44+
[guid]$UserObjectId,
45+
[Parameter(Mandatory = $true,ParameterSetName = "User name")]
46+
[string]$UserName,
47+
[Parameter(ParameterSetName = "User name")]
48+
[Parameter(ParameterSetName = "User object id")]
49+
[ValidateSet('*','DisplayName','FirstName','LastName','StreetAddress','PostalCode','City','Country','Department','Office','PhoneNumber','Title','IsLicensed','SignInName','UserPrincipalName','PasswordNeverExpires')]
50+
[string[]]$Properties = @('DisplayName','FirstName','LastName','IsLicensed','UserPrincipalName'),
51+
[Parameter(ParameterSetName = "User name")]
52+
[Parameter(ParameterSetName = "User object id")]
53+
[guid]$TenantId
54+
)
55+
56+
try{
57+
$Script:Usr
58+
if($Properties -contains '*'){
59+
$Properties = @('*')
60+
}
61+
62+
if($PSCmdlet.ParameterSetName -eq "User object id"){
63+
$Script:Usr = Get-MsolUser -ObjectId $UserObjectId -TenantId $TenantId | Select-Object $Properties
64+
}
65+
else{
66+
$Script:Usr = Get-MsolUser -TenantId $TenantId | `
67+
Where-Object {($_.DisplayName -eq $UserName) -or ($_.SignInName -eq $UserName) -or ($_.UserPrincipalName -eq $UserName)} | `
68+
Select-Object $Properties
69+
}
70+
71+
if($null -ne $Script:Usr){
72+
ConvertTo-ResultHtml -Result $Script:Usr
73+
}
74+
else{
75+
if($SRXEnv) {
76+
$SRXEnv.ResultMessage = "User not found"
77+
}
78+
Throw "User not found"
79+
}
80+
}
81+
catch{
82+
throw
83+
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#Requires -Version 4.0
2+
#Requires -Modules MSOnline
3+
4+
<#
5+
.SYNOPSIS
6+
Generates a report with a list of users from Azure Active Directory
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+
Azure Active Directory Powershell Module v1
20+
Requires Library Script ReportLibrary from the Action Pack Reporting\_LIB_
21+
22+
.LINK
23+
https://github.com/scriptrunner/ActionPacks/tree/master/O365/MSOnline/_REPORTS_
24+
25+
.Parameter HasErrorsOnly
26+
[sr-en] Inidates that this cmdlet returns only users that have validation errors
27+
[sr-de] Nur Benutzer mit Validierungsfehlern
28+
29+
.Parameter OnlyDeletedUsers
30+
[sr-en] Indicates that this cmdlet returns only users in the recycling bin
31+
[sr-de] Nur gelöschte Benutzer
32+
33+
.Parameter OnlyUnlicensedUsers
34+
[sr-en] Indicates that this cmdlet returns only users who are not assigned a license
35+
[sr-de] Nur Benutzer denen keine Lizenz zugewiesen wurde
36+
37+
.Parameter LicenseReconciliationNeededOnly
38+
[sr-en] Indicates that this cmdlet filter for only users that require license reconciliation
39+
[sr-de] Nur Benutzer die eine Lizenzabstimmung benötigen
40+
41+
.Parameter Filter
42+
[sr-en] Specifies the filter for enabled or disabled users
43+
[sr-de] Filter für aktivierte oder deaktivierte Benutzer
44+
45+
.Parameter TenantId
46+
[sr-en] Specifies the unique ID of a tenant
47+
[sr-de] Die eindeutige ID eines Mandanten
48+
#>
49+
50+
param(
51+
[switch]$HasErrorsOnly,
52+
[switch]$OnlyDeletedUsers,
53+
[switch]$OnlyUnlicensedUsers,
54+
[switch]$LicenseReconciliationNeededOnly,
55+
[ValidateSet('All','EnabledOnly', 'DisabledOnly')]
56+
[string]$Filter='All',
57+
[guid]$TenantId
58+
)
59+
60+
try{
61+
[string[]]$Properties = @('DisplayName','ObjectID','SignInName','UserPrincipalName','IsLicensed')
62+
63+
$Script:Users = Get-MsolUser -TenantId $TenantId -ReturnDeletedUsers:$OnlyDeletedUsers -UnlicensedUsersOnly:$OnlyUnlicensedUsers -EnabledFilter $Filter `
64+
-HasErrorsOnly:$HasErrorsOnly -LicenseReconciliationNeededOnly:$LicenseReconciliationNeededOnly | `
65+
Select-Object $Properties -Unique | Sort-Object -Property DisplayName
66+
if($null -ne $Script:Users){
67+
ConvertTo-ResultHtml -Result $Script:Users
68+
}
69+
else{
70+
if($SRXEnv) {
71+
$SRXEnv.ResultMessage = "No users found"
72+
}
73+
else{
74+
Write-Output "No users found"
75+
}
76+
}
77+
}
78+
catch{
79+
throw
80+
}

0 commit comments

Comments
 (0)