Link to home
Start Free TrialLog in
Avatar of Ans_wehave
Ans_wehaveFlag for United Kingdom of Great Britain and Northern Ireland

asked on

stop and start website on a remote iis 6.0 server

Hi
I want to start and stop a website on a IIS Server on server 2003 from windrows XP. All the machines are on one single domain. I have managed to get a script together to do this on the server but cannot do the same from the local machine. The error permeation denied comes up because the script s using my windrows credentials. I dont want to add the user to administrative group on the server. The scrip is as below.
----------------------------------------------------------------------------------------------------------------------------
' ------ SCRIPT CONFIGURATION ------

strComputer = "(Remot machin/IP address)"  'e.g. web01.rallencorp.com
strPath = "W3SVC/6167585"         'e.g. W3SVC/1
strUname = "administrator"
strPassword = "********"

' ------ END CONFIGURATION ---------
set objIIS = GetObject("IIS://" & strComputer & "/" & strPath)

objIIS.Stop
WScript.Echo "Web site " & strComputer & "/" & strPath & " successfully stopped"

objIIS.Start
WScript.Echo "Web site " & strComputer & "/" & strPath & " successfully started"

Can some one advise on how to make this script work from client machin may be use the GetObject in a better way.
Thank you.
Avatar of Da1King
Da1King

Have you tried running the script on your XP workstation using the RunAs Command and providing the server administrator credentials?
You can script a simple shell cmd of
Runas sc  \\dcname stop servicename
RunAs sc \\dc start servicename

sc is a resource kit utility

http://support.microsoft.com/kb/251192


and example script to shell as in vbscript
http://www.tek-tips.com/faqs.cfm?fid=2760

If you use the msscript debugger built into office, or another script editor it will compile it into an exe for you so your passwords not given in the script plain to read.  Otherwise you might as well give him admin rights.



I think an easier/more secure/safer option would be to allow the user the right to do it his with his own account though,


"How do I allow users to Start, Stop, and Pause a Windows 2000 / Windows XP Service"
http://www.jsifaq.com/SF/Tips/Tip.aspx?id=4673

this will also apply to 03 AD I use it myself.


zf

ASKER CERTIFIED SOLUTION
Avatar of zoofan
zoofan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any success setting up your service gpo?

zf
Just checking back with you to see how you made out.

zf