Hello,
I'm trying to parse the results of a cmdlet and was wondering if there is a way I could do it dynamically.
If you do a get-inboxrule and return all the properties, 50% are blank depending on the how complex the creation of the rule was. All the rules will not be the same, so the fields would change.
Is there a way to save the results without creating an array of all the properties and then do a check on each one to see if there is a value?
IE:
$mbx = get-inboxrule -Mailbox test.mailbox@microsoft.com -identity "BigInboxRule"
#Get-inboxrule has a bunch of properties... I want to #just filter out all the null ones and present only the #ones that have attributes.
#Am I stuck having to do something like this?
$properties = "isvalid","mailboxownerid","stopprocessingrules","redirectto","markasread" etc. etc.. until all properties for get-inboxrule are part of an array
$report = @()
foreach ($entry in $properties){
if ($mbx.entry -eq $null){
continue}
else{
$report += $mbx.entry}
Now, the example may not work, I just typed up a quick example, is this all that is available? Or is that the hard way? Any help is appreciated!