Como obter a senha de IUSR_*

Enquanto eu tentava diagnosticar um bug de autorização no SharePoint, eu acabei modificando a conta usada pelo IIS para representar o usuário anônimo.
Quando eu fui tentar colocar a conta de volta, eu descobri que eu não tinha a senha.
Por sorte, a senha fica armazenada no metabase do IIS 6.0 e com um script simplezinho é possível obtê-lo:
 
Dim IIsObject, SiteObject
Set IIsObject = GetObject ("IIS://localhost/w3svc")

Wscript.Echo Get_IUSR_Password(IIsObject)
Wscript.Echo Get_IWAM_Password(IIsObject)

Function Get_IUSR_Password(IIsObject)
  on error resume Next
  Dim Out
  Out = Out & vbCrLf & "<br>AnonymousUserName = " & IIsObject.Get("AnonymousUserName")
  Out = Out & vbCrLf & "<br>AnonymousUserPass = " & IIsObject.Get("AnonymousUserPass")
  If err=0 Then Out =  vbCrLf & "<br>Path:" & IIsObject.AdsPath & Out 
  Get_IUSR_Password = Out
End Function

Function Get_IWAM_Password(IIsObject)
  on error resume Next
  Dim Out
  Out = Out & vbCrLf & "<br>WAMUserName = " & IIsObject.Get("WAMUserName")
  Out = Out & vbCrLf & "<br>WAMUserPass = " & IIsObject.Get("WAMUserPass")
  If err=0 Then Out =  vbCrLf & "<br>Path:" & IIsObject.AdsPath & Out 
 
  Get_IWAM_Password = Out
End Function

 
Eu soube que tem scripts por aí que setam a bagaça, mas como este aqui resolveu o meu problema, eu nem procurei mais.
 

Published by

Alfred Myers

I have been interested in computers since I got my hands on a magazine about digital electronics back in 1983 and programming them has been paying the bills since 1991. Holding a dozen Microsoft certifications and being awarded Microsoft MVP in C# for five years in a row starting in 2007, recently I've been educating myself on open source technologies such as Linux, networking and the open web platform.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.