After using ConvertTo-Csv I can able to get the output in correct way but how to write the output foreach kb in csv.
Right now I getting output as below:
foreach ($task in $tasks) {
$task | Select @{N='VM';E={$_.VM}},
@{N='State';E={$_.Task.State}},
@{N='Error';E={$_.Task.TerminatingError.Message}},
@{N ='KB'; E={(($_.Task.Result.ScriptOutput |ConvertFrom-Csv).KB)}},
@{N ='Installstatus'; E={(($_.Task.Result.ScriptOutput |ConvertFrom-Csv).Installstatus)}}
}
output:
--------------------------------------
Expecting output as below:
VM : VM01
State: Success
Error:
KB: KB4565628
Installstatus: KBInstalled
VM : VM01
State: Success
Error:
KB: KB4565511
Installstatus: KBInstalled