Using the IIS ADSI object to retrieve the anonymous user password for a server via VBScript
Posted by: Jerry Lees
I recently had to change the anonymous user account for a change request for a site in IIS, but unfortunately the change did not work and we had to roll it back. However, I didn’t have and wouldn’t have known the account’s password since IIS and windows changes it periodically.
So, out came the scripting tool belt and I found that I had a script written previously that let me get the anonymous user account and password through the IIS ADSI object.
Below is a snippet from the script to display the password.
Function Get_IUSR_Password(ServerName)
Dim IIsObject
Set IIsObject = GetObject (“IIS://” & ServerName & “/w3svc”)
on Error resume Next
Get_IUSR_Password = IIsObject.Get(“AnonymousUserPass”)
On Error GoTo 0
End Function
Enjoy!




