Skip to content

Instantly share code, notes, and snippets.

@ddhahn
Created February 1, 2013 16:32
Show Gist options
  • Save ddhahn/4692403 to your computer and use it in GitHub Desktop.
Save ddhahn/4692403 to your computer and use it in GitHub Desktop.
Takes a list of computers and creates a filter that can be pasted into LDMS query.
$filter = "<filter> "
$computername_string = "`"Computer`".`"Computer Name`" = "
$machines = Get-Content "c:\temp\del_machines.txt"
$filter_string = $filter
foreach ($machine in $machines) {
if ($machine -ne "ServerName") {
$filter_string = $filter_string + $computername_string + "`"$machine`"" + " OR "
}
}
$filter_string = $filter_string + "</filter>"
Out-File -FilePath "c:\temp\output_filter.txt" -InputObject $filter_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment