Solved

Change Physical Path Credentials for Web Site using powershell

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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Utilizing an array to gracefully append to a list of EmailAddresses
The Nano Server Image Builder helps you create a custom Nano Server image and bootable USB media with the aid of a graphical interface. Based on the inputs you provide, it generates images for deployment and creates reusable PowerShell scripts that …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to count occurrences of each item in an array.

680 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