Solved

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

Posted on 2016-07-29
7
54 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 38

Expert Comment

by:Adam Brown
Comment Utility
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 12

Accepted Solution

by:
Dustin Saunders earned 500 total points
Comment Utility
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
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 1

Author Comment

by:sqlagent007
Comment Utility
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
Comment Utility
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 12

Expert Comment

by:Dustin Saunders
Comment Utility
Are you running Powershell as admin?
0
 
LVL 1

Author Closing Comment

by:sqlagent007
Comment Utility
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
A procedure for exporting installed hotfix details of remote computers using powershell
This tutorial will show how to push an installation of Backup Exec to an additional server in both 2012 and 2014 versions of the software. Click on the Backup Exec button in the upper left corner. From here, select Installation and Licensing, then I…
This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

772 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

12 Experts available now in Live!

Get 1:1 Help Now