Initial version from my blog post

http://www.technologytoolbox.com/blog/jjameson/archive/2009/03/26/script-to-restart-sharepoint-services.aspx