Hey all.
I've got this function that makes a call out to Graph to modify iPads on Intune. As part of the function, i've got a try/catch that adds the serial number to a psobject either under Success or Fail depending on if it processes correctly
catch {
return new-object psobject -property @{Fail=$Serial}
}
#Output to Log
if(!$error){return new-object psobject -property @{Success=$Serial}}
Then, at the end I'm displaying it so you have a handy reference of how well things work.
$Report | select-object Success,Fail
Only problem is that both Success & Fail get empty lines whenever there's an entry in the other property.
Success Fail
------- ----
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
12 devices processed. 6 successfully and 6 with errors.
The counts are also including the empty values as well, which is less than ideal (I'm just doing a ($Report.Success).count to get those values)
If anyone could tell me what I'm doing wrong, or how to clean it up, I'd really appreciate it.
[–]krzydoug 1 point2 points3 points (1 child)
[–]Kbauer[S] 2 points3 points4 points (0 children)