Skip to content

Instantly share code, notes, and snippets.

@stevenharman
Created January 23, 2012 22:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevenharman/1665918 to your computer and use it in GitHub Desktop.
Save stevenharman/1665918 to your computer and use it in GitHub Desktop.
managing an IIS AppPool from Ruby
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
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