On Error Resume Next

Set ShellApp = CreateObject("Shell.Application")
ReportErrors "Creating Shell.App"

set WshShell = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating WScript.Shell"
         
If WshShell.Regread("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\UseSearchOptions") = 0 then
	ReportErrors "Reading Use Search Options"
	WshShell.Regwrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Explorer Bars\{C4EE31F3-4768-11D2-BE5C-00A0C9A83DA1}\UseSearchOptions", 1, "REG_DWORD"
	ReportErrors "Writing Use Search Options"
End If
WScript.Sleep 100

ShellApp.findfiles
ReportErrors "Opening Find Files"

WScript.Sleep 100

While WshShell.AppActivate("Search Results") <> vbTrue
	WScript.Sleep 100
Wend
WshShell.SendKeys "%o%m"
WScript.Sleep 100
ReportErrors "Sending Keys"

Sub ReportErrors(strModuleName)
	If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
	Err.clear
End Sub