#Whos running the script $who = (whoami).split("\")[1] $outFile = "C:\users\$who\Desktop\VulnApps.txt" #Unquoted paths "UnQuoted Path Vulnerabilities" | Out-File $outFile "" | Out-File $outFile -Append $vulnSvc = gwmi win32_service | foreach{$_} | where {($_.pathname -ne $null) -and ($_.pathname.trim() -ne "")} | where {-not $_.pathname.startswith("`"")} | where {($_.pathname.substring(0, $_.pathname.indexof(".exe") + 4 )) -match ".* .*" } $vulnSvc.name | out-file $outFile -Append start notepad.exe $outFile