Open CraigTolley opened 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!"
}
}
Thanks again!
When creating a Host List report, the file is created but contains no data even though the list view shows the data.