Open ttd-kevinclement opened 6 days ago
Get-PnPUserProfileProperty
return type is SortedDictionary<string, object>
, as you can see at https://github.com/pnp/powershell/blob/ebff896b7978fdc09fee8a71006c8659f1c136b7/src/Commands/UserProfiles/GetUserProfileProperty.cs#L38 and https://github.com/pnp/powershell/blob/ebff896b7978fdc09fee8a71006c8659f1c136b7/src/Commands/UserProfiles/GetUserProfileProperty.cs#L154
It uses the standard PowerShell method Cmdlet.WriteObject
Here's an example in PowerShell showing the type of the returned object:
Note that Runbooks are different than running scripts on the console as there is no actual console for those scripts to write to. When running scripts on a computer with UI, the output is formatted by PowerShell automatically for that UI context, while runbooks don't.
Here are 2 examples. The first is the default behaviour on PowerShell running on my pc:
The 2nd has | Write-Host
which ends up showing the same as you posted:
A search suggested to use .GetEnumerator()
:
You could try Out-String
too, not sure if that would still show the type instead of the content.
Reporting an Issue or Missing Feature
Get-PnPUserProfileProperty returning unexpected results in Runbook
Expected behavior
Expecting a User Profile Properties PowerShell Object
Actual behavior
System.Collections.Generic.SortedDictionary``2[System.String,System.Object]
Steps to reproduce behavior
Connect-PnPOnline -Url "xxxxx-admin.sharepoint.com"
-ManagedIdentityGet-PnPUserProfileProperty -Account "xxxx.xxxx@domain.com
What is the version of the Cmdlet module you are running?
PnP.PowerShell 2.4.0
Which operating system/environment are you running PnP PowerShell on?
Comments
4061
This command works as intended in our sandbox tenant, when porting to our corporate tenant it behaves as mentioned above.