Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Windows Server 2008 R2 : Manage Internet Information Services (part 2) - Remotely Manage IIS Servers & Manage IIS with PowerShell

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
6/16/2011 11:44:11 AM

2. Remotely Manage IIS Servers

While you're using the IIS console to manage your local web server, you can also manage other IIS servers by using the IIS Management Console to connect to them. However, before you can remotely manage IIS on other servers, you have to configure remote management of the services. Specifically, you need to add the IIS management service and configure and start the service to be able to remotely manage your web servers.

First you need to install the remote management component of IIS either via Server Manager or via the command prompt. To add the component in Server Manager, follow these steps:

  1. Open Server Manager by selecting Start => Administrative Tools => Server Manager.

  2. Right-click the Web Server (IIS) role; you will see a menu similar to Figure 5. Select Add Role Services.

    Figure 5. Adding role services
  3. Select the Management Service box to add the remote management service; you may also want to select the IIS Management Scripts And Tools box to provide management capabilities via the command prompt. You can see an example of these services being installed in Figure 6.

    Figure 6. IIS remote management and scripting services
  4. Review the confirmation screen and your selections, and when you are ready, click Install.

  5. Review the summary screen, correct any error messages, and click Close.

To add the IIS management service via the command prompt, as in the case of a Windows Server 2008 R2 Server Core installation, type in the following command:

dism /online /enable-feature
/featurename:IIS-ManagementService

After you have installed the service, you then need to configure the registry to enable the remote management service:

  1. Click Start => Run.

  2. In the Run dialog box, type regedit.exe, and press Enter.

  3. In the registry, open the following location: HKEY_LOCAL_MACHINE\Software\Microsoft\WebManagement\Server.

  4. Set the EnableRemoteManagement key to the value of 1; you can see an example of this service enabled in Figure 7.

  5. Close the registry editor.

Figure 7. Enabling web management in the registry

After you have enabled the service in the registry, you need to configure the service to start and run. You can configure the service in the Services control panel, or you can use the command prompt to start the service. To use the Services control panel, follow these steps:

  1. Open Services by selecting Start => Administrative Tools => Services.

  2. Select Web Management Service, and click Start. If you want the service to start automatically, you can right-click the service and click Properties. You will see a screen similar to Figure 8.

  3. Set the service to start automatically, and click OK.

Figure 8. Web management service

If you want to start the service temporarily or start the service from the command prompt, you can just run the following command. This will not change the startup properties of the service, and the service is only temporary until the service is stopped or the server is rebooted.

net start wmsvc

If you want to have the service started automatically, for example, you are configuring Windows Server 2008 R2 Server Core, you can type in the following command:

sc config wmsvc start= auto

After you have followed those steps, you can remotely manage IIS web services from the IIS Management Console on a centralized workstation or server system. To connect to the remote servers, follow this procedure:

  1. Open the IIS Management Console by selecting Start => Administrative Tools => Internet Information Services (IIS) Manager.

  2. On the tree root on the left side of the console, right-click Start Page, and click Connect To Server.

  3. Type in the FQDN name or IP address of the server you want to remotely manage, and click Next.

  4. If you are prompted for credentials, type in the necessary administrative credentials, and click Next.

  5. Give your connection a new name if you desire, and then click Finish.

You then will be able to manage the new web server from your centralized console. This will make working with your web servers, particularly your Server Core installations, easier and more efficient. The new servers will appear in the tree on the left side of the console. You can see an example of the IIS Management Console connected to three web servers (the local server, Web edition, and a Server Core) in Figure 9.

Figure 9. IIS managing multiple servers

3. Manage IIS with PowerShell

One of the new additions to Windows Server 2008 R2 server is for the support of PowerShell cmdlets and IIS. Managing IIS with PowerShell gives you another avenue to manage and maintain your web servers. Also, with the added PowerShell support to Windows Server 2008 R2 Server Core, PowerShell provides you with an alternative to work with and configure your IIS servers on Server Core installations.

Before you can use the PowerShell utilities in IIS, you need to install the IIS Management Scripts and Tools role service for IIS:

  1. Open Server Manager by selecting Start => Administrative Tools => Server Manager.

  2. In Server Manager, click + next to Roles.

  3. Right-click Web Server (IIS), and select Add Role Services.

  4. Select IIS Management Scripts And Tools, and click Next.

  5. Review the summary screen, and click Install.

  6. Review the installation summary, and click Close.

After you have installed the scripts and tools, you have to make sure your PowerShell cmdlets, specifically your Web Administration module on your IIS servers, has been loaded.

  1. Load PowerShell by selecting Start => Administrative Tools And Windows PowerShell Modules.

  2. Run the following command:

    Get-Module -all | Where {$_.moduletype -eq "Binary"}
    |Format-List moduletype, name

    Verify Microsoft.IIS.Powershell.Provider is listed in your output list; you can see an example of this command in Figure 10.

    Figure 10. IIS PowerShell module
  3. If you do not see the IIS PowerShell provider loaded, run the following command to load the IIS PowerShell module:

    import-module WebAdministration

  4. After you have loaded or verified the IIS PowerShell module is loaded, you can then work with IIS Web Administration module.

After you have loaded the module, you can manage several aspects of the IIS environment from in PowerShell; if you want to see all the commands, you can type the following command in PowerShell:

get-command –pssnapin WebAdministration

You will see a list of all the PowerShell commands, as shown in Figure 11.

Figure 11. IIS PowerShell cmdlets

Table 2 describes some of the common cmdlets in IIS.

Table 2. IIS cmdlets
cmdletsDescription
get-websiteThis shows the basic configuration of the website including the directory location for the web files, port bindings, and locations.
backup-webconfigurationThis backs up your existing web configuration information.
restore-webconfigurationThis allows you to restore the backup in case of an IIS failure.
stop-websiteThis stops the website, . You can start, remove, or even stop websites from the PowerShell command prompt.
new-websiteThis allows you to create a new website with any settings you want to use.

If you wanted to create a new website called business portal on port 8080 with the website stored on the c:\bp drive, you would run the following PowerShell command:

new-website "business portal" -port 8080
-physicalpath "c:\bp"

You will notice there is one function listed, which is the IIS: function. This function allows you to navigate directly into the IIS configuration. When you type in the following command, you will be able to navigate the IIS configuration using common commands:

cd IIS:\

You can then navigate three different areas of IIS configuration: application pools, sites, and SSL Bindings. You can view or modify any of those areas by using directory navigation commands, such as cd and dir to view the information. For example, if you wanted to view some basic information about all the websites currently on the IIS server, you can perform the following steps:

  1. Open PowerShell, and verify the IIS administration module has been loaded.

  2. Enter cd iis:\, and hit Enter.

  3. At the command prompt, type the following to navigate to the site information: cd sites. Then hit Enter.

  4. Your command prompt should read PS IIS:\sites>. Type in dir, and you will see basic information about your websites. Figure 12 shows an example.

Figure 12. Sites in IIS PowerShell
Other -----------------
- Microsoft Dynamics CRM 2011 : Merging Account or Contact Records
- Microsoft Dynamics CRM 2011 : Assigning Accounts and Contacts to Other Users
- BizTalk 2009 : Host Integration Server 2009 - Performance Testing and Tuning
- BizTalk 2009 : Host Integration Server 2009 - Two-Phase Commit
- SQL Server 2008 : Automating Routine Maintenance - Maintenance Plans
- SQL Server 2008 : SQL Server Agent (part 2) - Jobs & Proxies
- SQL Server 2008 : SQL Server Agent (part 1) - Operators, Enabling SQL Server Agent Notifications & Alerts
- Windows Server 2008 R2 : Install Internet Information Services (part 2) - Install IIS on Windows Server 2008 R2 Core Server & Windows Server 2008 R2 Web Edition
- Windows Server 2008 R2 : Install Internet Information Services (part 1) - Understand Internet Information Services Role Services
- Microsoft Dynamics CRM 2011 : Sharing Accounts and Contacts with Other Users
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server