proxb / PoshPAIG

PowerShell UI used for auditing and installing updates from WSUS to local and remote systems
MIT License
207 stars 61 forks source link

Host List Export is Empty #3

Open CraigTolley opened 8 years ago

CraigTolley commented 8 years ago

When creating a Host List report, the file is created but contains no data even though the list view shows the data.

CraigTolley commented 8 years ago

The supplied collection to the Out-File is Null. Change $uiHash.Listview.DataContext to $uiHash.Listview.Items

The working code block for me is:

"Host File List" { If ($uiHash.Listview.Items.count -gt 0) { $uiHash.StatusTextBox.Foreground = "Black" $savedreport = Join-Path $Global:ReportPath "hosts.txt" $uiHash.Listview.Items | Select -Expand Computer | Out-File $savedreport $uiHash.StatusTextBox.Text = "Report saved to $savedreport" } Else { $uiHash.StatusTextBox.Foreground = "Red" $uiHash.StatusTextBox.Text = "No report to create!"
}
}

proxb commented 8 years ago

Thanks again!