stop and start website on a remote iis 6.0 server

Posted on 2007-08-01
Last Modified: 2012-08-13
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.

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

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

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

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.
Question by:Ans_wehave
    LVL 6

    Expert Comment

    Have you tried running the script on your XP workstation using the RunAs Command and providing the server administrator credentials?
    LVL 12

    Expert Comment

    You can script a simple shell cmd of
    Runas sc  \\dcname stop servicename
    RunAs sc \\dc start servicename

    sc is a resource kit utility

    and example script to shell as in vbscript

    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"

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


    LVL 12

    Accepted Solution

    Qouted from the fore mentioned article.

    4673 » How do I allow users to Start, Stop, and Pause a Windows 2000 / Windows XP Service? 11-Jan-02

    In order to Start, Stop, and Pause a service, users need the following permissions:


    Stop, Start, and Pause

    These permissions are only exposed in Group Policy.

    You can create OUs that contain the workstations that you want the policy applied to.

    To assign service permissions to the computers in an OU:

    01. Open the Active Directory Users and Computers snap-in.

    02. Right-click a domain and press New and Organizational Unit.

    03. Name the OU and press OK.

    04. Right-click this new OU and press Properties.

    05. Select the Group Policy tab.

    06. Press New and name the policy.

    07. Highlight the new policy and press Edit.

    08. Navigate to Computer Configuration / Windows Settings / Security Settings /System Services.

    09. Double-click the service you want users to manage.

    10. Check the Define this Policy Setting box.

    11. Remove the Everyone group.

    12. Add the System account, Domain Admins and any user or groups you desire.

    13. Grant the System account and Domain Admins Full Control. Grant the other users and groups both Read and Stop, Start, and Pause permissions.

    14. Press OK.

    15. Change the startup mode from Disabled to Automatic or Manual.

    16. Press Apply and OK.

    17. Close the policy and press OK.

    18. Move the computer accounts that you want effected into the OU.

    NOTE: See tip 2184 » Windows 2000 Group Policy refresh.

    LVL 12

    Expert Comment

    Any success setting up your service gpo?

    LVL 12

    Expert Comment

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


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  ( Here (http…
    Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
    Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now