Finding Within Files Like Grep

When you want to search through let's say scripts (e.g *.ps1) and find out where in the code you have used Get-WmiObject type:

select-string -path \\server\Homedrives\Username\*.ps1 Get-WmiObject -list

You can also use a function and place this in your profile to use within any powershell session:

filter grep($keyword) { if ( ($_ | Out-String) -like "*$keyword*") { $_ } }

Now to combine grep and old cmd command's you could do the following if you have psexec in your path e.g. windows\system32
psexec \\servername net session | grep "\\"
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License