Hi @honeybee170 ,
please try this:
$object_id = (Get-AzureADUser -ObjectID "username").ObjectID
$object_id
Another option you can try:
$object_id = Get-AzureADUser -ObjectID "username" | Select-Object -ExpandProperty ObjectID
$object_id
(If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)
Regards
Andreas Baumgarten