Any idea why the $result.PathName doesn't work?
$results = Get-WMIObject -query "select * from Win32_Service where Name LIKE '%sql%'" | Select Name, PathName | Format-List
ForEach ($result in $results) {
Write-Output "Test = " + $result.PathName
}
Write-Output "done"
Expected output:
Test = C:\blah\blah.sqlserver.exe
Test = C:\blah\blah.sqlserver.exe
Actual output
Test =
+
Test =
+