Skip to content

Instantly share code, notes, and snippets.

@mozziemozz
Created August 25, 2023 08:37
Show Gist options
  • Save mozziemozz/7d986581c385c9aeb04ce8a403dff19d to your computer and use it in GitHub Desktop.
Save mozziemozz/7d986581c385c9aeb04ce8a403dff19d to your computer and use it in GitHub Desktop.
Example script to validate Teams phone number assignments by using reverse number lookup
<#
.SYNOPSIS
Example script to validate Teams phone number assignments by using reverse number lookup function from this repo.
.DESCRIPTION
Author: Martin Heusser
Version: 1.0.0
Sponsor Project: https://github.com/sponsors/mozziemozz
Website: https://heusser.pro
.EXAMPLE
. .\ValidateTeamsRNLExample.ps1
#>
# Change these variables to match your environment
$adminUser = "user@domain.com"
$mfa = $false
$hideObjectId = $false
$lineURIs = @(
"+41xxxxxxxxx",
"+41xxxxxxxxx",
"+41xxxxxxxxx"
)
# End of adjustable variables
# Import functions by dot sourcing
. .\Scripts\ValidateTeamsReverseNumberLookup\ValidateTeamsReverseNumberLookup.ps1
$results = @()
foreach ($lineURI in $lineURIs) {
. Test-MZZTeamsLineURIAssignment -LineURI $lineURI -AdminUser $adminUser -MFA $mfa
if ($assignmentIsValid) {
if ($hideObjectId) {
$objectId = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
else {
$objectId = $reverseNumberLookup.objectId
}
}
else {
$objectId = "NotFound"
}
$resultDetails = [PSCustomObject]@{
LineURI = $lineURI
AssignmentIsValid = $assignmentIsValid
ObjectId = $objectId
}
$results += $resultDetails
}
$results | Format-Table -AutoSize
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment