Skip to content

Commit c27f6e2

Browse files
2.0.4 (#16)
* Update Send-EidUserMfaReport.ps1 Signed-off-by: Alex Ø. T. Hansen <94194707+System-Admins-ath@users.noreply.github.com> * Update Send-EidUserMfaReport.ps1 Signed-off-by: Alex Ø. T. Hansen <94194707+System-Admins-ath@users.noreply.github.com> * Bump module version to 2.0.4 Signed-off-by: Alex Ø. T. Hansen <94194707+System-Admins-ath@users.noreply.github.com> --------- Signed-off-by: Alex Ø. T. Hansen <94194707+System-Admins-ath@users.noreply.github.com>
1 parent a73601a commit c27f6e2

2 files changed

Lines changed: 18 additions & 11 deletions

File tree

src/SystemAdmins.MsMfaToolbox/SystemAdmins.MsMfaToolbox.psd1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
RootModule = 'SystemAdmins.MsMfaToolbox.psm1';
44

55
# Version number of this module.
6-
ModuleVersion = '2.0.3';
6+
ModuleVersion = '2.0.4';
77

88
# Supported PSEditions
99
CompatiblePSEditions = @('Core');

src/SystemAdmins.MsMfaToolbox/public/entraid/Send-EidUserMfaReport.ps1

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,12 @@ function Send-EidUserMfaReport
1515
#>
1616
[cmdletbinding()]
1717
[OutputType([void])]
18-
[ValidateScript({ $_ -match '' })]
1918
param
2019
(
2120
# E-mail address to send the report.
2221
[Parameter(Mandatory = $false)]
23-
[ValidateScript({ Test-EmailAddress -InputObject $_ })]
24-
[string]$EmailAddress = ((Get-EntraContext).Account),
22+
[ValidateScript({ ForEach-Object { Test-EmailAddress -InputObject $_ } })]
23+
[string[]]$EmailAddress = ((Get-EntraContext).Account),
2524

2625
# E-mail address to send from (e-mail must exist in the tenant).
2726
[Parameter(Mandatory = $false)]
@@ -147,6 +146,20 @@ function Send-EidUserMfaReport
147146
# Convert CSV to Base64.
148147
$attachment = [Convert]::ToBase64String([System.IO.File]::ReadAllBytes($outputFilePath));
149148

149+
# Create toRecipients array.
150+
$toRecipients = @();
151+
152+
# Foreach to e-mail address.
153+
foreach ($toRecipient in $EmailAddress)
154+
{
155+
# Construct toRecipients array.
156+
$toRecipients += @{
157+
emailAddress = @{
158+
address = $toRecipient;
159+
};
160+
};
161+
}
162+
150163
# Create parameters for sending the e-mail.
151164
$params = @{
152165
message = @{
@@ -155,13 +168,7 @@ function Send-EidUserMfaReport
155168
contentType = 'HTML';
156169
content = $html;
157170
};
158-
toRecipients = @(
159-
@{
160-
emailAddress = @{
161-
address = $EmailAddress;
162-
};
163-
}
164-
);
171+
toRecipients = $toRecipients;
165172
attachments = @(
166173
@{
167174
'@odata.type' = '#microsoft.graph.fileAttachment';

0 commit comments

Comments
 (0)