# Get-MgUserAuthenticationMethod--unable to extract additional values

**URL:** <https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090>\
**Category:** PowerShell Help\
**Created:** [December 5, 2022, 6:49pm UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090 "2022-12-05T18:49:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![magellan99](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@magellan99](https://forums.powershell.org/u/magellan99)\
**Post date:** [December 5, 2022, 6:49pm UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090/1 "2022-12-05T18:49:09Z")

</div>

Hi All,

When using Get-MgUserAuthenticationMethod I’m unalbe to extreact additional values…See below for the context…

```auto

Get-MgUserAuthenticationMethod -UserId $user22 | Get-Member -MemberType Properties

   TypeName: Microsoft.Graph.PowerShell.Models.MicrosoftGraphAuthenticationMethod

Name MemberType Definition                                                                              
---- ---------- ----------                                                                              
AdditionalProperties Property System.Collections.Generic.IDictionary[string,System.Object] AdditionalProperties {get;}
Id Property string Id {get;set;}

```

```auto
Get-MgUserAuthenticationMethod -UserId $user22 |select AdditionalProperties ## This Works!!!

AdditionalProperties                                                                                                                                                 
--------------------                                                                                                                                                 
{[@odata.type, #microsoft.graph.passwordAuthenticationMethod]}                                                                                                       
{[@odata.type, #microsoft.graph.microsoftAuthenticatorAuthenticationMethod], [displayName, iPhone 13], [deviceTag, SoftwareTokenActivated], [phoneAppVersion, 6.6.8]}

```

```auto

##This works but I want to more finite extractions

$(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties 

Key Value                                                      
--- -----                                                      
@odata.type #microsoft.graph.passwordAuthenticationMethod              
@odata.type #microsoft.graph.microsoftAuthenticatorAuthenticationMethod
displayName iPhone 13                                                  
deviceTag SoftwareTokenActivated                                     
phoneAppVersion 6.6.8

```

\*_//THIS does not work\*_

```auto

$(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties | Select DisplayName

DisplayName
-----------

```

///GOAL\\

I want to extract these additional values " DispayName, devicetag & SoftwareTokenActivated).

What is the proper snytax to extract this valies in a FL or FT output…?

Thanks in Advance

---

<div class="post-metadata">

**Author:** ![Olaf](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/olaf/32/992_2.png) [@Olaf](https://forums.powershell.org/u/Olaf)\
**Post date:** [December 5, 2022, 10:39pm UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090/2 "2022-12-05T22:39:17Z")

</div>

albert,  
Welcome to the forum. 👋🏽

Without having experiences with this topic or access to an Azure tenant …

> [@magellan99](#):
>
> I want to extract these additional values " DispayName, devicetag & SoftwareTokenActivated).

It looks like these properties are provided as hashtable. So you should be able to access the values with their key name.

```auto
(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties.displayName
#or
(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties.deviceTag

```

---

<div class="post-metadata">

**Author:** ![magellan99](https://avatars.discourse-cdn.com/v4/letter/m/e8c25b/32.png) [@magellan99](https://forums.powershell.org/u/magellan99)\
**Post date:** [December 6, 2022, 1:29am UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090/3 "2022-12-06T01:29:38Z")

</div>

Olaf,

Excellent, thx for the advice & guidance for a beginner…

```auto

(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties.displayName
iPhone 13

(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties.deviceTag
SoftwareTokenActivated

(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties.phoneAppVersion
6.6.8

```

Is there any optimal way to re-write the above three (3) PS cmdlet into a one-line that prints all three key names via one PS cmdlet…?

I tried this below via ExpandProperty , and got NULL results…

```auto

Get-MgUserAuthenticationMethod -UserId $user22 -ExpandProperty $odata.type | Select @{Name = 'DisplayName'; Expression = {$_.$odata.type.AdditionalProperties.displayName}} ## EMPTY DATA!!!!

DisplayName
-----------

```

Thanks in advance

---

<div class="post-metadata">

**Author:** ![adam-bukowski](https://avatars.discourse-cdn.com/v4/letter/a/9d8465/32.png) [@adam-bukowski](https://forums.powershell.org/u/adam-bukowski)\
**Post date:** [December 6, 2022, 10:29am UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090/4 "2022-12-06T10:29:22Z")

</div>

Hi  
Powershell is object language.  
You have to learn what  
“command | Get-Member” show to you  
and what expandproperty is doing with your object.  
Try with some simple commands like get-process etc.  
Good Luck 🙂

---

<div class="post-metadata">

**Author:** ![mawazo](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@mawazo](https://forums.powershell.org/u/mawazo)\
**Post date:** [December 6, 2022, 12:26pm UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090/5 "2022-12-06T12:26:27Z")

</div>

Use getenumerator method to drill through the hashtable then filter the key name with where object.

```auto
(Get-MgUserAuthenticationMethod -UserId $user22).AdditionalProperties.GetEnumerator() |
    Where-Object {$_.key -eq 'displayName' -or $_.key -eq 'deviceTag' -or $_.key -eq 'phoneAppVersion'} 

```

i’m not sure how to use select object with hashtable maybe someone can advice?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:16pm UTC](https://forums.powershell.org/t/get-mguserauthenticationmethod-unable-to-extract-additional-values/21090/6 "2024-05-16T20:16:20Z")

</div>


