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
3
votes
2 answers

Executing invoke-webrequest to get status of multple websites in Powershell

We have several websites and I don't want to check the status in powershell using invoke-webrequest -URI google.com every time. I drafted something like this, which isn't working and I'd like help with: $URLS = get-content…
3
votes
2 answers

list redirect destinations (URL) IIS sites

I have several redirect sites configured in IIS 8.5, and I want to list them all. I've tried: .\appcmd.exe list site * -section:system.webServer/httpRedirect but wildcards are not working fine with appcmd. I also tried from the WebAdministration…
Alexander Meise
  • 1,328
  • 2
  • 15
  • 31
3
votes
0 answers

COM error "class not registered" from WebAdministration module

I have been given some PowerShell scripts (created by someone else, long ago) to "fix". I am trying to rebuild them top work with our current sysytem. The problem is I can't even get past the second line of code. Import-Module…
LucyViolet
  • 1,031
  • 3
  • 11
  • 16
3
votes
0 answers

Powershell WebAdminstration New-Item: Length cannot be zero

I'm trying to use the following PowerShell script but get Length cannot be zero error: Import-Module WebAdministration $xml = [xml](Get-Content .\settings.xml) $websites = $xml.Websites foreach ($website in $websites.Website){ $dnsName =…
Azimuth
  • 2,599
  • 4
  • 26
  • 33
3
votes
1 answer

Microsoft.Web.Administration.Site when called method Stop() throws NotImplemenetedException

I am trying to stop a website in IIS. Here is my code Site oSite = SERVERMANAGER.Sites.FirstOrDefault(s => s.Name.IndexOf(websiteName) > -1); if (oSite != null) { //stop the site... oSite.Stop(); } When it reachers oSite.Stop(); it will…
3
votes
1 answer

Not able to access a local git server

We have installed a bonobogit server by following this guide: http://bonobogitserver.com/install/ I am able to access the repositories by using the web browser. I have created a XYZ repo using the browser. However when I try to clone it by using…
bubble
  • 3,408
  • 5
  • 29
  • 51
3
votes
1 answer

Can I create sites and application pools on a remote IIS server using Powershell?

I have a Powershell script that sets up new web servers. At the moment, you have to connect to the server via Remote Desktop and run the script locally; it uses the WebAdministration module and is full of pseudopaths like IIS:/Sites\www.mysite.com\…
Dylan Beattie
  • 53,688
  • 35
  • 128
  • 197
2
votes
1 answer

Why can't I add properties to a Membership Provider using PowerShell WebAdministration?

I have a web.config file, I need to add the SqlMembershipProvider to it for FBA, and I wanted to do it using the WebAdministration module for IIS through PowerShell. I used the Add-WebConfiguration cmdlet and can add the provider correctly but it…
Jim Brown
  • 498
  • 1
  • 6
  • 20
2
votes
0 answers

How to get a .NET Cores configuration using IIS GetWebConfiguration?

I'm creating a .NET Core 2.1 Web API project (with Angular 7 front-end) where I'm using the Microsoft.Web.Administration API to pull information from remote IIS web servers (mainly listing websites, applications, app-pools, etc.):…
Shawn Dell
  • 21
  • 2
2
votes
1 answer

Download a file which is generated through https call using powershell

Currently I have this short piece of code. The URL https://dosomething.do generates a .csv file. I can run the powershell code and in the shell I can see the content of the file. However the file itself is not downloaded. I would like to specify…
RayofCommand
  • 4,054
  • 17
  • 56
  • 92
2
votes
2 answers

Powershell: Dynamically gather data types for IIS configuration element validation

I'm attempting to dynamically use the Microsoft.Web.Administration namespace within a powershell cmdlet. Is there a way to add a variable into a Namespace.Class declaration. I'm using the namespace [Microsoft.Web.Administration] and it's class…
Paolis
  • 150
  • 9
2
votes
1 answer

How to set application identity of an application pool using web administration module in powershell?

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" How do I go about setting the application pool…
2
votes
1 answer

Are the properties in Power Shell FTP module(WebAdministration) Case-Sensitive?

PowerShell is case insensitive language and so are the modules like WebAdministration expected to be. This doesn't work: PS IIS:\AppPools> Set-ItemProperty .\DefaultAppPool -Name Enable32BitAppOnWin64 -Value $true Whereas this works: PS…
zerocool18
  • 523
  • 1
  • 4
  • 11
2
votes
0 answers

Test-Path IIS:\SslBinding using wildcard dns name throws illegal characters error

IIS10 on Windows 10 supports SSL bindings to wildcard host headers e.g. *.example.com. Creating a new SSL binding for a wildcard host header works fine, however, when the binding exists, Test-Path fails, throwing an InvalidArgument "Illegal…
Dave Transom
  • 4,085
  • 3
  • 21
  • 22
2
votes
1 answer

WMI - 'Access Denied' exception thrown while reading IIS applications in remote domain machine

Below is my code to read IIS applications in a remote machine which in in domain using WMI. var connOptions = new ConnectionOptions { Username = "USERNAME", …
Yash
  • 214
  • 4
  • 16