I am getting below output from powershell script to a variable, now i want to sum the fields “FailedCount=” , “SucceededCount=”, “TotalCount=” from below output and print on the console with a below format, how can i achieve it.<\/p>\n
Total count SucceededCount FailedCount<\/p>\n
57 50 7<\/p>\n
--------------------------------------------below is the output from my powershell script------------------<\/p>\n
{@{@odata.id=; CompletedDateSK=20210209; FailedCount=2; SucceededCount=14; PartiallySucceededCount=0; TotalCount=16}, @{@odata.id=; CompletedDateSK=20210210; FailedCount=5; SucceededCount=14;
\nPartiallySucceededCount=0; TotalCount=19}, @{@odata.id=; CompletedDateSK=20210211; FailedCount=1; SucceededCount=11; PartiallySucceededCount=0; TotalCount=12}, @{@odata.id=; CompletedDateSK=20210212;
\nFailedCount=0; SucceededCount=4; PartiallySucceededCount=0; TotalCount=4}, @{@odata.id=; CompletedDateSK=20210215; FailedCount=0; SucceededCount=4; PartiallySucceededCount=0; TotalCount=4}, @{@odata.id=;
\nCompletedDateSK=20210217; FailedCount=0; SucceededCount=3; PartiallySucceededCount=0; TotalCount=3}, @{@odata.id=; CompletedDateSK=20210218; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0;
\nTotalCount=2}, @{@odata.id=; CompletedDateSK=20210219; FailedCount=0; SucceededCount=1; PartiallySucceededCount=0; TotalCount=1}, @{@odata.id=; CompletedDateSK=20210222; FailedCount=0; SucceededCount=4;
\nPartiallySucceededCount=0; TotalCount=4}, @{@odata.id=; CompletedDateSK=20210223; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0; TotalCount=2}, @{@odata.id=; CompletedDateSK=20210224;
\nFailedCount=0; SucceededCount=1; PartiallySucceededCount=0; TotalCount=1}, @{@odata.id=; CompletedDateSK=20210225; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0; TotalCount=2}, @{@odata.id=;
\nCompletedDateSK=20210226; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0; TotalCount=2}}<\/p>\n
I am getting below output from powershell script to a variable, now i want to sum the fields “FailedCount=” , “SucceededCount=”, “TotalCount=” from below output and print on the console with a below format, how can i achieve it.<\/p>\n
Total count SucceededCount FailedCount<\/p>\n
57 50 7<\/p>\n
--------------------------------------------below is the output from my powershell script------------------<\/p>\n
{@{@odata.id=; CompletedDateSK=20210209; FailedCount=2; SucceededCount=14; PartiallySucceededCount=0; TotalCount=16}, @{@odata.id=; CompletedDateSK=20210210; FailedCount=5; SucceededCount=14;
\nPartiallySucceededCount=0; TotalCount=19}, @{@odata.id=; CompletedDateSK=20210211; FailedCount=1; SucceededCount=11; PartiallySucceededCount=0; TotalCount=12}, @{@odata.id=; CompletedDateSK=20210212;
\nFailedCount=0; SucceededCount=4; PartiallySucceededCount=0; TotalCount=4}, @{@odata.id=; CompletedDateSK=20210215; FailedCount=0; SucceededCount=4; PartiallySucceededCount=0; TotalCount=4}, @{@odata.id=;
\nCompletedDateSK=20210217; FailedCount=0; SucceededCount=3; PartiallySucceededCount=0; TotalCount=3}, @{@odata.id=; CompletedDateSK=20210218; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0;
\nTotalCount=2}, @{@odata.id=; CompletedDateSK=20210219; FailedCount=0; SucceededCount=1; PartiallySucceededCount=0; TotalCount=1}, @{@odata.id=; CompletedDateSK=20210222; FailedCount=0; SucceededCount=4;
\nPartiallySucceededCount=0; TotalCount=4}, @{@odata.id=; CompletedDateSK=20210223; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0; TotalCount=2}, @{@odata.id=; CompletedDateSK=20210224;
\nFailedCount=0; SucceededCount=1; PartiallySucceededCount=0; TotalCount=1}, @{@odata.id=; CompletedDateSK=20210225; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0; TotalCount=2}, @{@odata.id=;
\nCompletedDateSK=20210226; FailedCount=0; SucceededCount=2; PartiallySucceededCount=0; TotalCount=2}}<\/p>\n
Welcome.<\/p>\n
what have you tried? What is the code you use to generate this output?<\/p>\n
‘measure-object’ has a ‘sum’ but I don’t think that will help in your case, you propbably have to loop through all of them and add them up.<\/p>\n
e.g. for, foreach, do, any loop should do.<\/p>\n
If you post code, please use the ‘Insert Code’ button. Please and thank you!<\/p>\n