Repeating a task
Hi all,
We are currently using Power Automate to create on-prem users. The problem we’ve hit is that the UPN suffix is blank (different issue).
To get around this, I’ve made a PowerShell script that runs every 5 mins on a scheduled task. As I’ve found this evening, if there is more than one user that is missing a UPN suffix, it fails.
$LocalUsers = Get-ADUser -Filter {UserPrincipalName -notlike ‘*@*’} -Properties UserPrincipalName -ResultSetSize $null
$UPN = $LocalUsers.UserPrincipalName + “@tww-lab.co.uk”
Set-ADUser -Identity $LocalUsers.SamAccountName -UserPrincipalName $UPN
We want the script to find an entry missing a UPN suffix and correct it to Firstname.Lastname @ UPN
Is there a way we can do this or is there a better way to do this?
Hi all, We are currently using Power Automate to create on-prem users. The problem we’ve hit is that the UPN suffix is blank (different issue). To get around this, I’ve made a PowerShell script that runs every 5 mins on a scheduled task. As I’ve found this evening, if there is more than one user that is missing a UPN suffix, it fails. $LocalUsers = Get-ADUser -Filter {UserPrincipalName -notlike ‘*@*’} -Properties UserPrincipalName -ResultSetSize $null
$UPN = $LocalUsers.UserPrincipalName + “@tww-lab.co.uk”
Set-ADUser -Identity $LocalUsers.SamAccountName -UserPrincipalName $UPN We want the script to find an entry missing a UPN suffix and correct it to Firstname.Lastname @ UPN Is there a way we can do this or is there a better way to do this? Read More