Active directory domain change for IIS V6 web server - Is there a way to update the virtual directories web user via script?

Posted on 2011-10-25
Last Modified: 2013-08-02
we am in the process of creating a development environment for our web infrastructure.      We have cloned our content managment system and several web servers  {2003/iisv6} to a dev environment.    The web servers are now joined to a separate dev domain.   This is a copy of our production domain,   ie same usernames/  but different passwords and different domain name.

My question is,   does anyone have/know of a script of util that I can use to update the anonymous user on all of the virtual directories on the webservers?     Given that the web server has well over one hundred virtuals configured with different users,   it would be great if it would read the existing user,  and update it to the new domain.   {domaina\username --> domainb\username | new pass}

Any insights would be appreciated :)
Question by:fertigj
    LVL 6

    Assisted Solution

    Set adminManager = CreateObject("Microsoft.ApplicationHost.WritableAdminManager")
    adminManager.CommitPath = "MACHINE/WEBROOT/APPHOST"
    Set anonymousAuthenticationSection = adminManager.GetAdminSection("system.webServer/security/authentication/anonymousAuthentication", "MACHINE/WEBROOT/APPHOST/Contoso")
    anonymousAuthenticationSection.Properties.Item("enabled").Value = True
    anonymousAuthenticationSection.Properties.Item("userName").Value = "IUSR"
    anonymousAuthenticationSection.Properties.Item("password").Value = "P@ssw0rd"

    Open in new window
    LVL 6

    Accepted Solution

    For powershell example see

    Anything some:

     $server = "localhost"
     $siteName = ""
     $iis = [ADSI]"IIS://$server/W3SVC"
     $site = $iis.children | where { $_.keyType -eq "IIsWebServer" -and $_.ServerComment -eq $siteName }
     $path = [ADSI]($site.path+"/ROOT")
     $path.AnonymousUserName = "IUSR"
     $path.AnonymousUserPass = "P@ssw0rd"
     $path.AuthFlags = 3

    Featured Post

    Live: Real-Time Solutions, Start Here

    Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

    Join & Write a Comment

    Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
    The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    754 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

    18 Experts available now in Live!

    Get 1:1 Help Now