« Previous Next »

Thread: VBScript to add multiple IIS identies for a website

Last post 07-15-2009 1:10 PM by Mabudachi. 6 replies.

Average Rating Rate It (5)

RSS

Page 1 of 1 (7 items)

Sort Posts:

  • 08-14-2007, 10:31 AM

    • NickZe
    • Not Ranked
    • Joined on 02-16-2007, 8:17 PM
    • Posts 2

    VBScript to add multiple IIS identies for a website

    I have a script that included below that will create an application pool, create a website using the application pool, change the anonymous user and enable ssl. The only problem with it is when you right click on the finish site and look at properties in IIS there is no SSL port specified. I need to find a way to script the SSL port to be 443 and add that entry under Host Headers (multiple ssl identies for the website). I have searched and cannot find this information. Does anyone here know how?

    Thanks

    Nick
     

     

     *****************************************************************************************
    Option Explicit

    Dim sSiteID, sRegion, sWebSiteName, sOrgName, sIntIPAddress, objAppPools
    Dim sWebPath, objIIS, strWebID, ObjServerBindings, objWebSite, objPublic



    sSiteID = "12345"
    sRegion = "US"
    sIntIPAddress = "254.254.254.254"
    sWebPath = "\\server\folder\" & sRegion & "\" & sSiteID & "\"

    'Create Application Pool
    Set objAppPools = GetObject("IIS://localhost/W3SVC/AppPools")
    Set objAppPools = objAppPools.Create("IIsApplicationPool", sSiteID)
    objAppPools.SetInfo

    'Create Web Site
    set objIIS = GetObject("IIS://localhost/W3SVC")
    objServerBindings = Array(0)
    objServerBindings(0) = sIntIPAddress & ":" & 80 & ":" & ""

    strWebID = objIIS.CreateNewSite(sSiteID, objServerBindings, sWebPath)
    WScript.Echo strWebID

    'Sets Web Site Properties
    set objWebSite = GetObject("IIS://localhost/W3SVC/" & strWebID)
    objWebSite.AccessRead = True
    ObjWebsite.AppPoolID = sSiteID
    objWebsite.AccessScript = "True"
    objWebsite.AppFriendlyName = sSiteID
    objWebSite.SetInfo

    'Sets Access Properties
    objWebSite.AnonymousUserName = "domain\user"
    objWebSite.AnonymousUserPass = "P@ssword"
    objWebSite.AuthFlags = "1"
    objWebSite.SetInfo

    'Sets SSL on Public Directory
    'set objPublic = GetObject("IIS://localhost/W3SVC/" & strWebID & "Public")
    'objPublic.AccessSSLFlags = "264"
    objWebSite.AccessSSLFlags = "264"
    objWebSite.HttpErrors = "403,4,URL,/customerrors/" & sSiteID & ".htm"
    objWebSite.SetInfo

  • 08-14-2007, 10:53 AM In reply to

    • Hope4sun
    • Top 200 Contributor
    • Joined on 12-05-2006, 3:53 PM
    • UK
    • Posts 32

    Re: VBScript to add multiple IIS identies for a website

    Ya pretty much there, you just need to edit the SecureBindings portion of the metabase

    more info on securebindings

    http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/8d9f2a8f-cd23-448c-b2c7-f4e87b9e2d2c.mspx?mfr=true 

     and a good example of enumerating the bindings, etc.

    http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_Configuration.aspx

     
    I hope these help

    Andy
     

  • 07-14-2009, 4:59 PM In reply to

    Re: VBScript to add multiple IIS identies for a website

    Is it possible to enable SSL 128 bit encryption on a single file under a virtual directory through VBScript?  I have seen how to do it on the default web-site, but a little unsure how to make that work for the single file on a Windows 2003 server.

     Thanks.

    Eric

  • 07-15-2009, 12:34 AM In reply to

    Re: VBScript to add multiple IIS identies for a website

    This is not possible in Server 2003. You are only able to configure SSL settings at the web site level.
    Live, Love, Breathe, IIS
  • 07-15-2009, 3:31 AM In reply to

    Re: VBScript to add multiple IIS identies for a website

    Hi,

    That's not true. You can configure SSL down to the file level in IIS 6.0 :

    Configuring SSL on a Web Server or Web Site (IIS 6.0)

    Regards,

    Paul Lynch | www.iisadmin.co.uk
  • 07-15-2009, 12:06 PM In reply to

    Re: VBScript to add multiple IIS identies for a website

    Thanks for jumping there Paul, I should have clarified that further. I was going along the lines if you did not have an SSL cert added to a site. You have to have an SSL certificate enabled at the website level before you can go any lower. It was to late when I posted that ;)
    Live, Love, Breathe, IIS
  • 07-15-2009, 1:10 PM In reply to

    Re: VBScript to add multiple IIS identies for a website

    I'm looking for how to script this. I know I can do it by manually setting it on the file, but I'd really like to script it in VBScript. Is this possible?
Page 1 of 1 (7 items)
Microsoft Communities