So, you’ve installed a new server with Server 2008 R2 Core – what next? Logging on, you’re presented with a shiny command prompt, you can run notepad or regedit…but aside from that, where do you go from there? In the next few series of posts I’ll hopefully point out the basics, and some not so basics!
In this post, I’m covering Installing the IIS web server (and a few useful bits) and managing it from the IIS Management Snap-in.
Installing optional components in Server 2008 R2 Core is handled by two commands, OCList and OCSetup. OCList, as the name suggests, lists the optional components and their status, installed or not installed. It’s a long list, so I recommend issuing the command with the “|more” pipe:
oclist | more
The output looks something like this:
OCSetup will accept any one, or multiple, of the roles listed in OCList as an argument to install. It’s recommended you use the command with “start /w” preceding so that the command prompt will wait for the installation to finish before continuing.
To install the basic IIS web server install, use
start /w ocsetup IIS-WebServerRole
As far as I can see, this installs the roles:
Installed:IIS-WebServerRole
Installed:IIS-WebServer
Installed:IIS-ApplicationDevelopment
Installed:IIS-CommonHttpFeatures
Installed:IIS-DefaultDocument
Installed:IIS-DirectoryBrowsing
Installed:IIS-HttpErrors
Installed:IIS-StaticContent
Installed:IIS-HealthAndDiagnostics
Installed:IIS-HttpLogging
Installed:IIS-Performance
Installed:IIS-HttpCompressionStatic
Installed:IIS-Security
Installed:IIS-RequestFiltering
Installed:IIS-WebServerManagementTools
In order to get .Net functioning and allow remote management, you’ll also need the following components installed, a registry key added and the Web Management Service Started (in order):
start /w ocsetup WAS-NetFxEnvironment start /w ocsetup IIS-ISAPIExtensions start /w ocsetup IIS-ISAPIFilter start /w ocsetup IIS-NetFxExtensibility start /w ocsetup IIS-ASPNET start /w ocsetup IIS-ManagementServicereg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WebManagement\Server /v EnableRemoteManagement /t REG_DWORD /d 1
net start wmsvc
You should now be able to manage your IIS server via the IIS Management Console on a Windows Server 2008 or Windows 7 PC with Remote Server Administration Tools installed.
You can also manage IIS through a PowerShell addin, if you run powershell.exe on your Server Core installation, then import the WebAdministration Module:
C:\Users\Administrator>powershell Windows PowerShell Copyright (C) 2009 Microsoft Corporation. All rights reserved.PS C:\Users\Administrator> Import-Module WebAdministration PS C:\Users\Administrator> Get-Command -PsSnapin WebAdministration
CommandType Name Definition
Cmdlet Add-WebConfiguration Add-WebConfiguration [-Filte… Cmdlet Add-WebConfigurationLock Add-WebConfigurationLock [-F… Cmdlet Add-WebConfigurationProperty Add-WebConfigurationProperty… Cmdlet Backup-WebConfiguration Backup-WebConfiguration [-Na… Alias Begin-WebCommitDelay Start-WebCommitDelay Cmdlet Clear-WebConfiguration Clear-WebConfiguration [-Fil… Cmdlet Clear-WebRequestTracingSettings Clear-WebRequestTracingSetti… Cmdlet ConvertTo-WebApplication ConvertTo-WebApplication [[-… Cmdlet Disable-WebGlobalModule Disable-WebGlobalModule [-Na… Cmdlet Disable-WebRequestTracing Disable-WebRequestTracing [[… Cmdlet Enable-WebGlobalModule Enable-WebGlobalModule [-Nam… Cmdlet Enable-WebRequestTracing Enable-WebRequestTracing [[-… Alias End-WebCommitDelay Stop-WebCommitDelay Cmdlet Get-WebAppDomain Get-WebAppDomain [-InputObje… Cmdlet Get-WebApplication Get-WebApplication [[-Name] … Cmdlet Get-WebAppPoolState Get-WebAppPoolState [[-Name]… Cmdlet Get-WebBinding Get-WebBinding [[-Name] <Str… Cmdlet Get-WebConfigFile Get-WebConfigFile [[-PSPath]… Cmdlet Get-WebConfiguration Get-WebConfiguration [-Filte… Cmdlet Get-WebConfigurationBackup Get-WebConfigurationBackup [… Cmdlet Get-WebConfigurationLocation Get-WebConfigurationLocation… Cmdlet Get-WebConfigurationLock Get-WebConfigurationLock [-F… Cmdlet Get-WebConfigurationProperty Get-WebConfigurationProperty… Cmdlet Get-WebFilePath Get-WebFilePath [[-PSPath] <… Cmdlet Get-WebGlobalModule Get-WebGlobalModule [[-Name]… Cmdlet Get-WebHandler Get-WebHandler [[-Name] <Str… Cmdlet Get-WebItemState Get-WebItemState [[-PSPath] … Cmdlet Get-WebManagedModule Get-WebManagedModule [[-Name… Cmdlet Get-WebRequest Get-WebRequest [-InputObject… Cmdlet Get-Website Get-Website [[-Name] <String… Cmdlet Get-WebsiteState Get-WebsiteState [[-Name] <S… Cmdlet Get-WebURL Get-WebURL [[-PSPath] <Strin… Cmdlet Get-WebVirtualDirectory Get-WebVirtualDirectory [[-N… Function IIS: set-location IIS: Cmdlet New-WebApplication New-WebApplication [-Name] <… Cmdlet New-WebAppPool New-WebAppPool [-Name] <Stri… Cmdlet New-WebBinding New-WebBinding [[-Name] <Str… Cmdlet New-WebFtpSite New-WebFtpSite [-Name] <Stri… Cmdlet New-WebGlobalModule New-WebGlobalModule [-Name] … Cmdlet New-WebHandler New-WebHandler [-Name] <Stri… Cmdlet New-WebManagedModule New-WebManagedModule [-Name]… Cmdlet New-Website New-Website [-Name] <String>… Cmdlet New-WebVirtualDirectory New-WebVirtualDirectory [-Na… Cmdlet Remove-WebApplication Remove-WebApplication [-Name… Cmdlet Remove-WebAppPool Remove-WebAppPool [-Name] <S… Cmdlet Remove-WebBinding Remove-WebBinding [-Protocol… Cmdlet Remove-WebConfigurationBackup Remove-WebConfigurationBacku… Cmdlet Remove-WebConfigurationLocation Remove-WebConfigurationLocat… Cmdlet Remove-WebConfigurationLock Remove-WebConfigurationLock … Cmdlet Remove-WebConfigurationProperty Remove-WebConfigurationPrope… Cmdlet Remove-WebGlobalModule Remove-WebGlobalModule [-Nam… Cmdlet Remove-WebHandler Remove-WebHandler [-Name] <S… Cmdlet Remove-WebManagedModule Remove-WebManagedModule [-Na… Cmdlet Remove-Website Remove-Website [-Name] <Stri… Cmdlet Remove-WebVirtualDirectory Remove-WebVirtualDirectory [… Cmdlet Rename-WebConfigurationLocation Rename-WebConfigurationLocat… Cmdlet Restart-WebAppPool Restart-WebAppPool [[-Name] … Cmdlet Restart-WebItem Restart-WebItem [[-PSPath] <… Cmdlet Restore-WebConfiguration Restore-WebConfiguration [-N… Cmdlet Select-WebConfiguration Select-WebConfiguration [-Fi… Cmdlet Set-WebBinding Set-WebBinding [[-Name] <Str… Cmdlet Set-WebConfiguration Set-WebConfiguration [-Filte… Cmdlet Set-WebConfigurationProperty Set-WebConfigurationProperty… Cmdlet Set-WebGlobalModule Set-WebGlobalModule [-Name] … Cmdlet Set-WebHandler Set-WebHandler [-Name] <Stri… Cmdlet Set-WebManagedModule Set-WebManagedModule [-Name]… Cmdlet Start-WebAppPool Start-WebAppPool [[-Name] <S… Cmdlet Start-WebCommitDelay Start-WebCommitDelay [-Verbo… Cmdlet Start-WebItem Start-WebItem [[-PSPath] <St… Cmdlet Start-Website Start-Website [[-Name] <Stri… Cmdlet Stop-WebAppPool Stop-WebAppPool [[-Name] <St… Cmdlet Stop-WebCommitDelay Stop-WebCommitDelay [[-PSPat… Cmdlet Stop-WebItem Stop-WebItem [[-PSPath] <Str… Cmdlet Stop-Website Stop-Website [[-Name] <Strin…
Not that you’d doubt me (!) but there’s one last thing to do - prove it worked. Fortunately, there’s an easy way to do that. I borrowed the code from www.codefixer.com to create a little “hello world” page. Since the default website is c:\inetpub\wwwroot\ I saved the page there as default.aspx and fired up my browser – et voila!