Questions tagged [web-administration]

Microsoft's API for administering IIS in .NET.

The Microsoft.Web.Administration API:

contains classes that a developer can use to administer IIS Manager. With the classes in this namespace, an administrator can read and write configuration information to ApplicationHost.config, Web.config, and Administration.config files.

The classes in the Microsoft.Web.Administration namespace contain a series of convenient top-level objects that allow the developer to perform administrative tasks. The different logical objects available include sites, applications, application pools, application domains, virtual directories, and worker processes. You can use the API to obtain and work with the configuration and state of these objects and to perform such actions as creating a site, starting or stopping a site, deleting an application pool, recycling an application pool, and even unloading application domains.

80 questions
43
votes
4 answers

How to specify application pool identity user and password from PowerShell

I have been having lots of difficulty automating the setup of a Web application and configuring IIS appropriately with the Application Pool Identity. I am doing this in a Web application deployment script written in PowerShell. My requirement is…
paulyphonic
  • 854
  • 1
  • 6
  • 15
26
votes
4 answers

Import-Module WebAdministration wont load from script but does from command line

I'm coming onto a project that uses PowerShell to script the build. The build makes use of the WebAdministration module to manage the local IIS instance. When I run the build script the following error is thrown when trying to import…
Klee
  • 2,022
  • 3
  • 23
  • 32
20
votes
3 answers

Why does Set-ItemProperty have no effect for IIS applications under Windows 10?

Most of our web applications include a Deploy.ps1 Powershell script. Octopus Deploy uses this to configure apps during production deployments, but we also use it to set up developers' local IIS settings. Works absolutely fine on Windows 7, Windows…
Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
14
votes
1 answer

How to check whether an application pool exists or not in IIS using powershell and web administration module?

I am using powershell to automate configuring websites in my IIS. I have the following code that creates a web application pool for me #Creating a new Application Pool New-WebAppPool "NewAppPool" But before creating the pool, I want to check…
Shruti Agarwal
  • 887
  • 2
  • 14
  • 29
13
votes
1 answer

Add-PsSnapin WebAdministration in Windows7

I want to use PowerShell to administer my IIS7 on Windows7 64 bits. I try install IIS7 Powershell snap-in http://www.iis.net/download/PowerShell I "Run as administrator", then typing the command listed below: msiexec /I iis7psprov_x64.msi but I…
Kiquenet
  • 14,494
  • 35
  • 148
  • 243
8
votes
3 answers

Specific PowerShell Module Not Autoloading

Im using PowerShell 4 on Windows Server 2012 R2. A specific module, WebAdministration, does not get auto loaded when calling a Cmdlet that comes from this module. All other modules I have tried auto load successfully. I can load this module manually…
8
votes
1 answer

Powershell command works in Powershell but not inside of a script, why?

I wanted to outfile my IIS Bidings to csv or txt , I am simply playing around a bit using that cmdlet : Get-ChildItem -path IIS:\Sites which works perfectly, also outfiling to .txt works perfect using this command : Get-ChildItem -path IIS:\Sites |…
RayofCommand
  • 4,054
  • 17
  • 56
  • 92
7
votes
1 answer

Use passthru to make sure the cmdlet is finished

I'm confused how -Passthru works. From my understanding, the -Passthru parameter is used for passing the result of a cmdlet to the pipeline even the cmdlet itself doesn't produce any results. I tried to write these code first: (I'm trying to recycle…
wontasia
  • 522
  • 1
  • 6
  • 10
6
votes
2 answers

How can I impersonate a user across un-trusted domains?

Machine A and Machine B are in different domains. Machine A uses a VPN to gain access to Machine B's network. I am trying to impersonate a user for the purpose of using Microsoft.Web.Adminstration to do some administrationy things in IIS on Machine…
BVernon
  • 3,205
  • 5
  • 28
  • 64
5
votes
1 answer

How to update "physical path" of a site on IIS 10 using Powershell?

When creating a site I manage to set the path with the following line of code New-WebSite -Name "mysite" -port 8084 -PhysicalPath "c:\inetpub\wwwroot" -ApplicationPool "myappPool" I have tried to figure out how to update the path, nothing found via…
rhellem
  • 769
  • 1
  • 11
  • 26
5
votes
1 answer

How do I set overrideMode of Forms Authentication (system.web/authentication) of IIS with powershell?

I need to automate the configuration of a new IIS server with powershell, and I need to change the Feature Delegation setting for the Forms Authentication feature (its overrideMode). I'm basically looking to change the overrideMode seen when I use…
Yanick Girouard
  • 4,711
  • 4
  • 19
  • 26
5
votes
2 answers

State property of Site throwing "NotImplementedException" in IIS Express

I am using Microsoft.Web.Administration.dll to check states of my sites by using following code. It works fine with IIS but when it's used in IIS Expresss, then 'State' property throws 'NotImplementedException'. ServerManager manager = new…
NalinBhatia
  • 131
  • 9
4
votes
2 answers

PowerShell: command "Get-ChildItem IIS:\Sites" causes an error

Simple script shown below causes an exception on my computer: Import-Module WebAdministration Get-ChildItem IIS:\Sites Results: powershell -NonInteractive .\test.ps1 Get-ChildItem : Could not load file or assembly…
Sergey Popov
  • 199
  • 1
  • 3
  • 10
4
votes
1 answer

Could not load file or assembly {assembly name here} or one of it's dependencies. Access is denied

So sometimes our web servers (Windows Server 2008, IIS 7.5) will randomly get this error on a really really old .net 2.0ish asp.net/classic asp web site that we have. Normally an IIS reset will clear up the issue, but this issue is now starting to…
4
votes
4 answers

How to set IIS ApplicationPool "Private Memory Limit" value using PowerShell

I'm using PowerShell for auto-deploying website, and recently found AppPool setting which cannot be set with PS. or at least I did not manage to find out how to do it. $appPool = $serverManager.ApplicationPools.Add($sitename)... I need to set…
Alexander Doroshenko
  • 1,715
  • 1
  • 17
  • 24
1
2 3 4 5 6