Solved

Change Physical Path Credentials for Web Site using powershell

Posted on 2014-04-25
1
2,072 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

 Database Backup and Recovery Best Practices

Join Percona’s, Architect, Manjot Singh as he presents Database Backup and Recovery Best Practices (with a Focus on MySQL) on Thursday, July 27, 2017 at 11:00 am PDT / 2:00 pm EDT (UTC-7). In the case of a failure, do you know how long it will take to restore your database?

Question has a verified solution.

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

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
There are times when we need to generate a report on the inbox rules, where users have set up forwarding externally in their mailbox. In this article, I will be sharing a script I wrote to generate the report in CSV format.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
The viewer will learn how to dynamically set the form action using jQuery.

617 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