[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 648
  • Last Modified:

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.
0
Ans_wehave
Asked:
Ans_wehave
  • 4
1 Solution
 
Da1KingCommented:
Have you tried running the script on your XP workstation using the RunAs Command and providing the server administrator credentials?
0
 
zoofanCommented:
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

0
 
zoofanCommented:
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:

Read

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.


zf
0
 
zoofanCommented:
Any success setting up your service gpo?

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

zf
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now