Solved

Change Physical Path Credentials for Web Site using powershell

Posted on 2014-04-25
1
2,002 Views
Last Modified: 2014-04-25
I need to set the Physical path Credentials for a Website in IIS7 using Powershell.

I can get my powershell code to run without error but it never changes the actual credentials. Even after an IISRESET. I need advice on how to set the Physical Path Crednetials for a site using powershell.

Here is what I've tried :
Attempt #1 :
---------------
import-module webadministration
Set-ItemProperty "IIS:\Sites\MyWeb" -Name virtualDirectoryDefaults.username -Value "domain\username"
Set-ItemProperty "IIS:\Sites\MyWeb" -Name virtualDirectoryDefaults.password -Value "Mypassword"
---------------

Attempt #2
---------------
import-module webadministration
$website = get-item "IIS:\sites\MyWeb"
$website.virtualDirectoryDefaults.userName = "domain\username"
$website.virtualDirectoryDefaults.password = "Mypassword"
$website | set-item
0
Comment
Question by:JasonLattin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 

Accepted Solution

by:
JasonLattin earned 0 total points
ID: 40023251
Ok... I found a solution...

Attempt #3
import-module webadministration
Set-WebConfiguration "/system.applicationHost/sites/site[@name='MyWeb' and @id='1']/application[@path='/']/VirtualDirectory[@path='/']" -Value @{userName="domain\username";password= "Mypassword"}
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question