Solved

Change Physical Path Credentials for Web Site using powershell

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
Set OWA language and time zone in Exchange for individuals, all users or per database.
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

705 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now