add: Error handling to output functions
This commit is contained in:
@@ -266,9 +266,7 @@ function Get-CISMSTeamsOutput {
|
|||||||
$CsTeamsMessagingPolicy = Get-CsTeamsMessagingPolicy -Identity Global | Select-Object -Property AllowSecurityEndUserReporting
|
$CsTeamsMessagingPolicy = Get-CsTeamsMessagingPolicy -Identity Global | Select-Object -Property AllowSecurityEndUserReporting
|
||||||
return $CsTeamsMessagingPolicy
|
return $CsTeamsMessagingPolicy
|
||||||
}
|
}
|
||||||
default {
|
default { throw "No match found for test: $Rec" }
|
||||||
Write-Output "No matching action found"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end {
|
end {
|
||||||
|
@@ -39,6 +39,11 @@ function Get-CISMgOutput {
|
|||||||
}
|
}
|
||||||
process {
|
process {
|
||||||
switch ($rec) {
|
switch ($rec) {
|
||||||
|
'1.1.1' {
|
||||||
|
# 1.1.1
|
||||||
|
$AdminRoleAssignmentsAndUsers = Get-AdminRoleUserAndAssignment
|
||||||
|
return $AdminRoleAssignmentsAndUsers
|
||||||
|
}
|
||||||
'1.1.3' {
|
'1.1.3' {
|
||||||
# Step: Retrieve global admin role
|
# Step: Retrieve global admin role
|
||||||
$globalAdminRole = Get-MgDirectoryRole -Filter "RoleTemplateId eq '62e90394-69f5-4237-9190-012177145e10'"
|
$globalAdminRole = Get-MgDirectoryRole -Filter "RoleTemplateId eq '62e90394-69f5-4237-9190-012177145e10'"
|
||||||
@@ -84,11 +89,7 @@ function Get-CISMgOutput {
|
|||||||
return $null
|
return $null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Default {
|
default { throw "No match found for test: $Rec" }
|
||||||
# 1.1.1
|
|
||||||
$AdminRoleAssignmentsAndUsers = Get-AdminRoleUserAndAssignment
|
|
||||||
return $AdminRoleAssignmentsAndUsers
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end {
|
end {
|
||||||
|
Reference in New Issue
Block a user