Created
January 23, 2012 22:43
-
-
Save stevenharman/1665918 to your computer and use it in GitHub Desktop.
managing an IIS AppPool from Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32ole' | |
# Connect to the WMI WebAdministration namespace. | |
web_admin = WIN32OLE.connect("winmgmts:root\\WebAdministration") | |
app_pool = web_admin.get("ApplicationPool.Name='DefaultAppPool'") | |
app_pool.stop | |
app_pool.start | |
app_pool.recycle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'win32/registry' | |
keyname = "SOFTWARE\\Microsoft\\InetStp\\Components" | |
registry = Win32::Registry::HKEY_LOCAL_MACHINE.open(keyname) | |
tools_installed = registry["ManagementScriptingTools"] == 1 | |
puts "IIS Management Scripts and Tools installed? #{tools_installed}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment