ASP.NET - Reseting application pool's password

Asked By Shilpa Sharma on 09-Mar-15 01:38 PM
I am trying to reset application pool's password through the code. While execution, it runs without any error. But it seems password change is not getting reflected for the application pool (as the excepted result could not be seen after successful execution of the following code)
Following is the code snippet

Private Sub ResetAppPoolPassword(ByVal appPoolPwd As String)
Dim metabasePath As String = "IIS://" + System.Environment.MachineName + "/W3SVC/AppPools/" + ConfigurationManager.AppSettings("AppPoolName")


Dim apppools As DirectoryEntry = New DirectoryEntry(metabasePath)

apppools.InvokeSet(


"WAMUserPass", New Object() {appPoolPwd})

apppools.Invoke(


"SetInfo", Nothing)

apppools.CommitChanges()

apppools.Invoke(


"Recycle", Nothing)


End Sub
   
What modification needs to be performed in the above code to make it work as expected

  1. Is there any way to check the current password of the application pool

I am using Windows Server 2008 and IIS 7.5