setting IIS anonymous user with vbscript / asdutil.vbs
Posted on 2008-10-17
Using script below I am trying to change the anon user for IIS 6 2003 Srv from IUSR_<machinename> to a local user I created. I get no errors, however when I check default web site with IIS mmc gui the anon user does not change. When I view anon user with adsutil it shows it did change. Anyone have idea what I am doing wrong? Thanks.
service_account_name = "svcacct"
Set objNetwork = CreateObject("Wscript.Network")
strComputer = objNetwork.ComputerName
'set IIS anon account
wscript.echo "Setting IIS account"
Set objShell = CreateObject("Wscript.Shell")
strRun1 = "cscript.exe C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/anonymoususername " & strComputer &"\"& service_account_name
strRun2 = "cscript.exe C:\Inetpub\AdminScripts\adsutil.vbs set w3svc/anonymoususerpass " & service_account_name
objShell.Run strRun1, 1, True
objShell.Run strRun2, 1, True