IIS 7 and Above
RELIABLE iterative search-and-update of password for service account...
Re: RELIABLE iterative search-and-update of password for service acco...
Sep 09, 2019 07:24 AM|tmsatgmail|LINK
Update - I have found a workaround of sorts - create a Microsoft.Web.Administration.ServerManager object and use that to iterate through sites, applications and virtual directories. This lets me retrieve the .UserName and .password properties from ALL virtual
directories, anywhere inside IIS.
I used Get functions for site, app and virtual directory - the combined output from all three functions asserts that there are no credentials assigned to a virtual directory Test5,
I pointed ServerManager at the same virtual directory, and with just two lines of code I can see its username and password.
I used Set-WebConfigurationProperty to change the username and password to something else (using the fullpath returned by the Get-WebVirtualDirectory function which reports those credentials as empty.
I then checked the credentials again via both methods.
ServerManager confirms to me that the password has been changed successfully.
Get-WebVirtualDirectory STILL tells me the credentials are empty.