Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Change Physical Path Credentials for Web Site using powershell

Posted on 2014-04-25
1
Medium Priority
?
2,175 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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 …

721 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