Home > Blockchain >  Powershell: Output for Record not working
Powershell: Output for Record not working

Time:01-29

I have the following small scriptlet:

$JSON_obj = Get-Content -Path "C:\temp\importfile.json" | ConvertFrom-JSON

foreach ($Record_Set in $JSON_obj) {

 $Record_Set.Records

}

Running the script does not show anything on the console. If I manually type Record_Set.Records, the data will be shown. Any idea what could be the issue?

e.g. $Record_Set.Records-->

Host         : ns1-01.azure-dns.com.
Email        : azuredns-hostmaster.microsoft.com.
SerialNumber : 1
RefreshTime  : 3600
RetryTime    : 300
ExpireTime   : 2419200
MinimumTtl   : 300

CodePudding user response:

you can try and add write-host:

$JSON_obj = Get-Content -Path "C:\temp\importfile.json" | ConvertFrom-JSON

foreach ($Record_Set in $JSON_obj) {

 write-host $Record_Set.Records

}
  •  Tags:  
  • Related