Function Splat-Foo { Param($computername,$namespace,$class,$report) Write-Host "Getting WMI data for $computername" -foregroundcolor cyan $wmi=Get-WmiObject -Namespace $namespace -Class $class -computername $computername Write-Host "Saving results to $report" -foregroundcolor cyan $wmi | select * | Out-File $report } $data="godot7","root\cimv2","win32_operatingsystem","c:\temp\WMIReport.txt" Splat-Foo @data Get-Content $data[-1]