I am using the following code to get a dump of exchange data, but I don’t want attributes that don’t have data with it. How do I go through the attributes and remove the attributes that don’t have data?
<pre class=“lang:ps decode:true”>Get-MailboxStatistics -identity $ID | Select DisplayName, @{expression={$.totalDeletedItemSize.value.ToKB()};label=“DelSize(KB)”}, MailboxGUID, ServerName, @{Name=“Mailbox Size (MB)”;Expression={$.“TotalItemSize”.Value.ToMB()}}, StorageGroupName, DatabaseName, itemcount, LastLogonTime |
Out-File -encoding ascii $User -width 750
Get-Mailbox -identity $ID |Format-List * |
Out-File -encoding ascii $User -width 750 -append
$conn.Close()
Get-content $User | where {$_ -ne ""} | Out-file $Newfile
Remove-Item $User</pre>