Discussion:
script to create a website in IIS
(too old to reply)
Sylvia
2007-08-03 16:13:47 UTC
Permalink
I found this script in the repository, and it works great. however, I need
to modify it so that when I look at the Home directory tab "Read" is checked
off" and "Execute permissions" say "Scripts only". I can't find any
directions on how to do that.

How can I modify this script for that?

Thanks!

strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")

Set objWebService = objWMIService.ExecQuery _
("Select * From IISWebService")

arrBindings = Array(0)
Set arrBindings(0) = _
objWMIService.Get("ServerBinding").SpawnInstance_()
arrBindings(0).IP = "192.168.1.1"
arrBindings(0).Port = "8383"
arrBindings(0).Hostname = "atl-ws-01"

For Each objItem in objWebService
objItem.CreateNewSite "Test Site", arrBindings, _
"c:\inetpub\wwwroot"
Next
SlowBob
2007-08-08 20:34:02 UTC
Permalink
You have created the site and now just need to configure it.

There is an excellent article on MSDN that covers this topic:

http://msdn2.microsoft.com/en-us/library/ms524913.aspx

The directory perms are controlled by the AccessFlags property. In the MSDN
article, this line specifies the perms.

vdirObj.AccessFlags = 513 ' read, script

1 = None
513 = Scripts only
517 = Scripts and Executables

Hope this helps. Let us know if it does.
Post by Sylvia
I found this script in the repository, and it works great. however, I need
to modify it so that when I look at the Home directory tab "Read" is checked
off" and "Execute permissions" say "Scripts only". I can't find any
directions on how to do that.
How can I modify this script for that?
Thanks!
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")
Set objWebService = objWMIService.ExecQuery _
("Select * From IISWebService")
arrBindings = Array(0)
Set arrBindings(0) = _
objWMIService.Get("ServerBinding").SpawnInstance_()
arrBindings(0).IP = "192.168.1.1"
arrBindings(0).Port = "8383"
arrBindings(0).Hostname = "atl-ws-01"
For Each objItem in objWebService
objItem.CreateNewSite "Test Site", arrBindings, _
"c:\inetpub\wwwroot"
Next
Glenn
2007-08-14 19:53:41 UTC
Permalink
Is there a way to apply this rights to a virtual website?
Post by SlowBob
You have created the site and now just need to configure it.
http://msdn2.microsoft.com/en-us/library/ms524913.aspx
The directory perms are controlled by the AccessFlags property. In the MSDN
article, this line specifies the perms.
vdirObj.AccessFlags = 513 ' read, script
1 = None
513 = Scripts only
517 = Scripts and Executables
Hope this helps. Let us know if it does.
Post by Sylvia
I found this script in the repository, and it works great. however, I need
to modify it so that when I look at the Home directory tab "Read" is checked
off" and "Execute permissions" say "Scripts only". I can't find any
directions on how to do that.
How can I modify this script for that?
Thanks!
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")
Set objWebService = objWMIService.ExecQuery _
("Select * From IISWebService")
arrBindings = Array(0)
Set arrBindings(0) = _
objWMIService.Get("ServerBinding").SpawnInstance_()
arrBindings(0).IP = "192.168.1.1"
arrBindings(0).Port = "8383"
arrBindings(0).Hostname = "atl-ws-01"
For Each objItem in objWebService
objItem.CreateNewSite "Test Site", arrBindings, _
"c:\inetpub\wwwroot"
Next
@discussions.microsoft.com>
2007-10-03 11:55:05 UTC
Permalink
Post by Glenn
Is there a way to apply this rights to a virtual website?
Post by SlowBob
You have created the site and now just need to configure it.
http://msdn2.microsoft.com/en-us/library/ms524913.aspx
The directory perms are controlled by the AccessFlags property. In the MSDN
article, this line specifies the perms.
vdirObj.AccessFlags = 513 ' read, script
1 = None
513 = Scripts only
517 = Scripts and Executables
Hope this helps. Let us know if it does.
Post by Sylvia
I found this script in the repository, and it works great. however, I need
to modify it so that when I look at the Home directory tab "Read" is checked
off" and "Execute permissions" say "Scripts only". I can't find any
directions on how to do that.
How can I modify this script for that?
Thanks!
strComputer = "."
Set objWMIService = GetObject _
("winmgmts:{authenticationLevel=pktPrivacy}\\" _
& strComputer & "\root\microsoftiisv2")
Set objWebService = objWMIService.ExecQuery _
("Select * From IISWebService")
arrBindings = Array(0)
Set arrBindings(0) = _
objWMIService.Get("ServerBinding").SpawnInstance_()
arrBindings(0).IP = "192.168.1.1"
arrBindings(0).Port = "8383"
arrBindings(0).Hostname = "atl-ws-01"
For Each objItem in objWebService
objItem.CreateNewSite "Test Site", arrBindings, _
"c:\inetpub\wwwroot"
Next
Loading...