?
Solved

Powershell - windows 2008 r2 - how to change IIS [application user (pass-through authentication)

Posted on 2016-07-29
7
Medium Priority
?
157 Views
Last Modified: 2016-08-02
I need to create a powershell script that changes the IIS setting: "authentication" > "connect as" > "specific user" > "set" > to domain\service_account.

See attached for location
How-can-I-change-the-IIS-7-w-powersh.pdf
0
Comment
Question by:sqlagent007
  • 4
  • 2
7 Comments
 
LVL 43

Expert Comment

by:Adam Brown
ID: 41735201
Open Powershell on the IIS server, Run the following:
add-pssnapin WebAdministration

Open in new window


Then run this:
set-webconfigurationproperty "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='/']/virtualDirectory[@path='/']" -name username -value ''user@domain.com"
set-webconfigurationproperty "system.applicationHost/sites/site[@name='Default Web Site']/application @path='/']/virtualDirectory[@path='/']" -name password -value 'password'

Open in new window

0
 
LVL 14

Accepted Solution

by:
Dustin Saunders earned 2000 total points
ID: 41735210
Give this a go.  Specify the credentials you want to use at the top and the website name, and fire away.

Import-Module -Name "web*"

$taregtUser="donstupid@wizdev.local"
$taregtPWD="2stupid4u"
$siteName='"Default Web Site"'
$pathToSite='system.applicationhost/sites/site[@name='+$siteName+']'
$pathToValues=$pathtosite+'/application[@path="/"]/virtualdirectory[@path="/"]'

Get-WebConfiguration $pathToSite | select *
set-WebConfigurationproperty $pathToValues -name username -value $taregtUser
set-WebConfigurationproperty $pathToValues -name password -value $taregtPWD

Open in new window

0
 
LVL 1

Author Comment

by:sqlagent007
ID: 41735225
what do I do when I get an error: " The Windows PowerShell snap-in 'WebAdministration' is not installed on this machine."
pssnapin-webAdministration-error.tiff
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 1

Author Comment

by:sqlagent007
ID: 41735243
For both solutions, I am getting this error:
The term 'Get-WebConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program.

Open in new window


The term 'Get-WebConfiguration' is not recognized as the name of a cmdlet, function, script file, or operable program.
Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:21
+ Get-WebConfiguration <<<<
    + CategoryInfo          : ObjectNotFound: (Get-WebConfiguration:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
0
 
LVL 1

Author Comment

by:sqlagent007
ID: 41735246
To me it looks like the "WebAdministration" module is installed...When I run Get-Module -ListAvailable

PS C:\Windows\system32> Get-Module -ListAvailable

ModuleType Name                      ExportedCommands
---------- ----                      ----------------
Manifest   ActiveDirectory           {}
Manifest   ADRMS                     {}
Manifest   AppLocker                 {}
Manifest   BestPractices             {}
Manifest   BitsTransfer              {}
Manifest   PSDiagnostics             {}
Manifest   ServerManager             {}
Manifest   TroubleshootingPack       {}
Manifest   WebAdministration         {}

Open in new window

0
 
LVL 14

Expert Comment

by:Dustin Saunders
ID: 41739730
Are you running Powershell as admin?
0
 
LVL 1

Author Closing Comment

by:sqlagent007
ID: 41739794
Thanks, I needed to close the PS terminal and re-open it. Then I was able to bring in the WebAdministration module.
0

Featured Post

Industry Leaders: 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

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…
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.
This tutorial will show how to configure a single USB drive with a separate folder for each day of the week. This will allow each of the backups to be kept separate preventing the previous day’s backup from being overwritten. The USB drive must be s…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

830 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