≡ Menu

Windows Search Enable Your Script Files

At the July 8th Tampa PowerShell User Group meeting, Ed Wilson (blog|twitter) gave a presentation on “PowerShell Best Practices.” One of the tips Ed mentioned is enabling Windows Search to index the content of PowerShell ps1 files. Although I’ve used grep or in PowerShell, Select-String to find strings within script files there are advantages to being able to search  in Windows Explorer and yes its OK to use the GUI sometimes.

If like me you haven’t used Windows Search features in years, you’re probably wondering how to you set the indexing options. So I’ve provided a step-by-step guide…

Changing Indexing Options

In Windows 7 or Vista on the Start Menu in the Search Programs type Indexing options

Select Indexing Options located under Control Panel


Under Indexing Options select Advanced


Next select the File Types tab

Select the ps1 file extension and with the file extension selected, choose Index Properties and File Content

Click OK and Close


Window will start indexing your ps1 file immediately. You will then be able to search the content of PowerShell scripts within Windows Explorer. Here’s an example searching for the string invoke-coalesce across all PowerShell scripts:


Although grep and select-string are more full-featured (for example the matching line and line numbers can be returned), Windows Search is fine for simple searches. You may want to enable content search for other types of script files such as .sql files also

Comments on this entry are closed.

%d bloggers like this: