To go across all applications you will need to enable “GUI scripting” and use System Events.
Open the Universal Access preference pane and make sure “Enable access for assistive devices” is checked.
Then this AppleScript should be close to what you want:
set searchString to "whatever"
tell application "System Events"
repeat with aWindow in ¬
(get windows of (application processes whose visible is true) ¬
whose name contains searchString)
set aWindow to contents of aWindow
if aWindow is not missing value and ¬
(exists attribute "AXMinimized" of aWindow) then ¬
set value of attribute "AXMinimized" of aWindow to true
end repeat
end tell