For the "Get-Msoldomain" powershell command - let me get the output below (allows you to call it Output # 1), where the names of the properties, status and authentication are the names of the properties and their respective values ββare given below.
Name Status Authentication
myemail.onmicrosoft.com Verified Managed
When I use the command with "ConvertTo-Json" as shown below
GetMsolDomain |ConvertTo-Json
I get the output below (allows you to call its output number 2) in Json format.
{
"ExtensionData": {
},
"Authentication": 0,
"Capabilities": 5,
"IsDefault": true,
"IsInitial": true,
"Name": "myemail.onmicrosoft.com",
"RootDomain": null,
"Status": 1,
"VerificationMethod": 1
}
However, the problem is that if you notice the Status property on both outputs, it is different. The same thing happens for the VerificationMethod property . Without using ConvertTo-JSon, Powershell yields the text, and with ConvertTo-Json it gives an integer.
get-msoldomain |Select-object @{Name='Status';Expression={"$($_.Status)"}}|ConvertTo-json
{
"Status": "Verified"
}
, -, - ,
Select-object @{Name='Status';Expression={"$($_.Status)"}}
, VerificationMethod, , .
: - , ConvertTo-Json, Enum , , , - :
{
"ExtensionData": {
},
"Authentication": 0,
"Capabilities": 5,
"IsDefault": true,
"IsInitial": true,
"Name": "myemail.onmicrosoft.com",
"RootDomain": null,
"Status": "Verified",
"VerificationMethod": "DnsRecord"
}