Run PowerShell Scripts from an HTA Menu

Here is a simple menu to run a dozen different PowerShell Scripts;
Just the thing for people who need to run a bunch of canned scripts on a regular basis.
Copy this and save it as HTA type file. eg. MyMenu.hta  
 
Be carefull of the line wraps. Everything the between the <BR>’s is one line
 
 
<!–

‘======================================

‘ VBScript Source File — Created with SAPIEN Technologies PrimalScript 2007

‘ NAME: MyMenu.hta

‘ AUTHOR: OldDog
‘ DATE  : 7/29/2009

‘ COMMENT: Use Short Path Names!!!!!! You find them by doing a DIR /x

‘=========================
–>
<HTML>
<HEAD>
<TITLE>MyMenu.hta</TITLE>
<script LANGUAGE="vbscript">
Sub Window_Onload
 self.Focus()
 self.ResizeTo 900,700
End Sub
Sub runhta(htaSrc)
 Dim WshSHell
 set WshShell = CreateObject("WScript.Shell")
 WshShell.Run(htaSrc)
End Sub
</script>
</HEAD>
<BODY STYLE="font:14 pt arial; color:white;
 filter:progid:DXImageTransform.Microsoft.Gradient
(GradientType=1, StartColorStr=’#000000′, EndColorStr=’#0000FF’)">
</style>
<CENTER><H2>My Menu</H2></CENTER>
<HR>
<OL>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1FCTopology Locater.ps1’)">FCTopology Locater</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1FC_4Gb_Drive_check.ps1’)">FC_4Gb_Drive_check</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Remote_Ports_check.ps1’)">Remote_Ports_che­ck</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Connection_Counter_check.ps1’)">Connection_Counter_check</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1SubSystem_Table.ps1’)">SubSystem_Table</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Soft_Reset_check.ps1’)">Total_Soft_Reset_check</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Rogue_Events.ps1’)">Rogue_Events</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Maximum-Values.ps1’)">Maximum-Values</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Maxtor_Drives_Search.ps1’)">Maxtor_Drives_Search</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1QLA4010 HBA_Locator.ps1’)">QLA4010 HBA_Locator</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Raid_Device_and_Extent_Counter.ps1’)">Raid_Device_and_Extent_Counter</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1Search_for_SATA_revisions.ps1’)">Search_for_SATA_revisions</a>
<BR>
<LI><a href="#" onClick="runhta(‘powershell -noexit C:PROGRA~1PhoneH~1System_Upgrade_Dates.ps1’)">System_Upgrade_Dates.ps1</a>
<BR>
</OL>
<BR><BR><BR>
<CENTER><BUTTON onclick="self.close()">Exit</BUTTON></CENTER>
<BR>
</BODY>
</HTML>
 
 
 
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s