1

How would I call on the Physical Path credentials property for web applications in IIS using PowerShell? I can't print out the username or password, but I can print the logonMethod which uses the same property? Below is my code for web applications. I have tried using $webapp.virtualDirectoryDefaults and using $webapp.userName but neither works for web applications.

   $webapps = Get-WebApplication -Site $Site.name
   foreach($webapp in $webAPPS)
   {
       Write-Host $webapp.applicationPool
       Write-Host $WebApp.virtualDirectoryDefaults.userName
       Write-Host $webapp.virtualDirectoryDefaults.password
       Write-Host $webapp.virtualDirectoryDefaults.logonMethod
       $webapp2 = $webapp.path
       Write-Host $WebApp2.split("/")[-1] "::: is the Web Application" -ForegroundColor Green
   } 
Andrew Schulman
  • 8,561
  • 21
  • 31
  • 47
user38725
  • 369
  • 3
  • 5
  • 13
  • If the logon credentials for the physical path is set explicitly on the vDirs, then `$WebApp.virtualDirectoryDefaults.userName` and `.password` will be empty. You'll need to grab it from the individual vDirs – Mathias R. Jessen Jul 14 '14 at 15:58
  • @MathiasR.Jessen But wont that give the virtual directory physical path username and password instead of the web application username and password? – user38725 Jul 14 '14 at 18:44
  • Strange, the credentials for the Application itself does not seem to get exposed by the object returned from `Get-WebApplication`. Would pulling it directly from the `applicationHost.config` file be an acceptable solution? The password would be encrypted and non-transferable – Mathias R. Jessen Jul 17 '14 at 15:40
  • @MathiasR.Jessen If we can call all web applications username/password in IIS that'd would be awesome! Just weird that I can call on the logonMethod object but not the username/password object for web applications, when the object exists there and gives you the automatic fill for username and password. – user38725 Jul 17 '14 at 17:14

0 Answers0