Greetings,
MS support created a script, that was working fine until I change computers. Now, when I try to run it, it fails with the folowing:
Set-AzureADUserExtension : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ObjectId'. Specified method is not supported.
At line:5 char:43
Set-AzureADUserExtension -ObjectId $user.ObjectId -ExtensionNa ...."
Like I mentioned, the only change was a different computer and last time we ran this script was around October 2022.
The script is the following:
Import-Csv .\users.csv | ForEach-Object { $user = Get-AzureADUser -Searchstring $_.UserPrincipalName $logfile = ".\logger.txt"
Set-AzureADUserExtension -ObjectId $user.ObjectId -ExtensionName "extension_My custom extension goes here" -ExtensionValue $user.PhysicalDeliveryOfficeName
Add-Content $logfile -value "Added Extension for $($user.DisplayName)