Installing Windows Server Backup

Despite the Windows Server Backup being listed in Administrative Tools, the Windows Server Backup feature will still need to be installed. The easiest way to install Windows Backup tools is by using Add Features in the Server Manager. For Windows Server Core installations, installing with PowerShell is the preferred method.

Installing Windows Server Backup with Server Manager

On every edition of Windows Server 2008 R2, except for Server Core installations, the Windows Server Backup feature can be installed using Server Manager. To install the Windows Server Backup feature, perform the following steps:

  1. Log on to  Windows Server 2008 using an account with admin privileges.
  2. Hit Start, click All Programs, then click Administrative Tools, and select the Server Manager.
  3. On the tree panel, select the node named Features.
  4. Select  Add Features link in the tasks panel.
  5. After the Add Features Wizard has opened,  select the plus sign beside Windows Server Backup Features. Check both boxes to make sure that the commandline tools are also installed. Click Next to continue.
  6. Review the summary on the Confirm Installation Selections page and then click Install.
  7. The installation has now been performed, on the Installation Results page review the installation results, and then click Close.

Installing Windows Server Backup with Windows PowerShell Server Manager

Often, admins may elect to use  PowerShell  to manage a server and for installing roles, role services, or other features. When a feature or role is installed using PowerShell ServerManager module, all features, role services, and role dependencies are added as well. To install Windows Server Backup features, including  Windows Server Backup PowerShell cmdlets with  PowerShell, follow the below steps:

  1. Log on to  Windows Server 2008 using an account with admin privileges.
  2. Hit Start, click All Programs, then click Accessories, and click the PowerShell folder to display the application shortcuts.
  3. Right-click PowerShell and then select Run As Administrator, if the User Account Control window opens, just click Continue to open PowerShell.
  4. Type cd \ and hit Enter.
  5. Type in Import-Module ServerManager and hit Enter.
  6. Type in Add-WindowsFeature Backup-Tools and hit Enter. Once the installation has complete, the results will shown  in the window.
  7. Type in Get-WindowsFeature |More and hit Enter to generate a listing of the installed roles, role services, as well as features. Review the list to make sure that both the Windows Server Backup and Windows Server Backup command-line tools have been installed.
  8. Type in  exit in the PowerShell window and hit Enter.

Installing Windows Server Backup on Server Core Installations

On a Windows  Server Core installation, if the Windows Server Backup feature isn’t already installed, it may be installed by following the below steps:

  1. Log on to  Windows Server Core using an account with admin privileges.
  2. In Command Prompt  type in cd \ and hit Enter.
  3. Type Start /w ocsetup.exe WindowsServerBackup and hit Enter.
  4. Log on to a different Windows Server Enterprise Edition system with an admin account on the local system as well as on the Windows Server Core system (assuming  both systems are part of the same domain and also that the Windows  Server Core system is able to access other resources on the network from the Windows Server Core system).
  5. Select Start > All Programs > Administrative Tools > Windows Server Backup.
  6. In the Actions panel, select Connect to Another Computer and the Computer Chooser window will open.
  7. Select  Another Computer, type the name of the Windows Server Core system, and hit OK.
  8. If you are able to connect to the Windows Server Core system, the installation will have been successful. If the connection should fail, either the Windows Server Core firewall is blocking  the connection or Windows Server Backup has not been successfully installed.

Monitoring Processor (CPU) Usage in Windows Server

To analyze the processor (CPU) utilization of your system you should focus on  two counters - % Processor Time and Interrupts/sec.  % Processor Time shows the percentage of overall CPU utilization. If there is more than one  processor  on a system, a counter for each one is shown as well as the total (combined) value counter. If % Processor Time averages a usage rate of over 50% for extended durations, you should first review other system counters to try and identify  processes which may be improperly using the processing resource or alternatively consider upgrading the processor. Consistent CPU utilization around the 50% range does not necessarily impair performance, however, the average processor utilization goes beyond 65%  performance will almost certainly be impaired. If the system has multiple processors installed, you should use the % Total Processor Time counter to determine the average usage of all processors.

Interrupts/sec is useful for providing an overall  guide of processor health. This counter indicates the number of device interrupts which the processor  is handling per second. Similar to the Page Faults/sec counter  this counter can show very high numbers (well into the thousands) without there being a significantly performance drag.

In general, conditions which could indicate a processor bottleneck include the below:

  • “Average of % Processor Time” is consistently beyond 60%–70%. Additionally, spikes which frequently occur frequently of 90% or greater can also indicate a bottleneck even if the average is below  60%–70%.
  • “Maximum of % Processor Time” is consistently beyond 90%.
  • “Average of the System Performance Counter; Context Switches/second” is consistently beyond 20,000.
  • “System Performance Counter; Processor Queue Length” is consistently higher than two.


Monitor Windows Server System Memory and Pagefile Usage

Available memory is usually the most common source for performance issues on a Windows Server installation. Fortunately, however, it is an easy metric to measure since there are several counters in the memory object which can help troubleshoot memory issues. Most notable there are, two very important counters which provide a reasonably accurate overview of memory pressures, namely Page Faults/sec and Pages/sec memory. Just using these two memory counters alone can highlight if the system is correctly configured and experiencing memory issues. The below are the counters necessary to monitor memory and pagefile usage.

  • Committed Bytes – monitors the amount of memory (in bytes) which has been allocated by the various processes. As this increases above available memory so does the pagefile size  since paging has increased.
  • Pages/sec – Shows the number of pages which are read from or written to the disk.
  • Pages Output/sec – Shows the virtual memory pages written to the pagefile per second which can help to identify paging as a bottleneck.
  • Page Faults/sec – Reports both the soft and the hard faults.
  • Working Set,_Total – Shows the amount of virtual memory which is actually being used.
  • %pagefile in use - Shows the percentage of the paging file which is actually being used which can be used to check if the Windows pagefile is a potential bottleneck. If this consistently remains above 50% or 75% you should consider increasing the pagefile size or alternatively moving the pagefile to a another disk.


Using PowerShell for SQL Server Admin

All SQL Server 2008 installations will automatically have PowerShell. As a SQL Server DBA you will not survive  without knowing PowerShell in future. For SQL Server there is a separate component of  PowerShel – SQLPS. You start SQLPS in SQL Server or by typing SQLPS in command prompt. SQLPS loads required components which you can work with SQL Server. In the normal PowerShell editor SQL Server related components are not loaded.

Starting SQLPS from SQL Server:

PowerShell for SQL Server


PowerShell for SQL Server

In SQLPS there is a directory structure which you can traverse through that using “cd” which is essentially an alias of Set-Location cmdlet. You can see the directories available in each level by executing “dir” which is another alias for the Get-ChildItem cmdlet.

PowerShell for SQL Server

In the root there are four logical drives or directories as you can see in the above screenshot.

  1. SQL
  2. SQLPolicy
  3. SQLRegistration
  4. DataCollection

The below screenshot shows that I have traversed through the directory structure upto “tables” object in my local server. Look at the prompt carefully.

PowerShell for SQL Server

Now if you execute “dir” you will get a list of tables available in the AdventureWorks database. You can execute T-SQL commands at this point. For example to get a list of the top 10 tables with the highest number of records.

gci | sort-object -Property RowCount -Desc | select-object schema,name -first 10 | format-table


Managing System Services using PowerShell

You can manage system services in local or remote computers using PowerShell. PowerShellprovides you set of cmdlets to work with system services. They are;

  • Get-Service
  • Stop-Service
  • Start-Service
  • Suspend-Service
  • Resume-Service
  • Restart-Service
  • Set-Service
  • New-Service

Let’s consider a simple scenario – you need to stop the SQLBrowser service running in a remote computer. The below statement above get the SQLBrowser service in remote computer, Susantha-lp and stores in a variable called “$s”

$s = Get-Service -Name SQLBrowser -ComputerName susantha-lp

The next step  is to stop the service.  There are two different methods available for doing this:

  1. You can use Stop-Service cmdlet or
  2. You can invoke stop() method in “$s” object

The first method of stopping the service can be achieved using the below code:

$s | Stop-Service

The second method is:


Both methods are really simple. My preference would be for the second method due to its object oriented approach.Continues…

Using PowerShell with Event Logs

Reading Event logs with PowerShell

An event log is a windows service that manages event logging in a computer. When this service is started, Windows logs important information about the operation of the system and the applications running on it . The logs available on a system depend on the system’s role and the services installed.

Two general types of log files are used;

  1. Windows log
  2. Application and services log

Event log records events of different categories. namely:

  • Information
  • Warning
  • Error
  • Critical
  • Audit success
  • Audit failures

The GUI Event Viewer   is used to view the individual  events in an event log. In addition to  the GUI tool, PowerShell can be used to query the event log. The following PowerShell cmdlets can be used to manage the event log:

  • Get-WinEvent
  • Get-EventLog
  • Clear-EventLog
  • Limit-EventLog
  • Show-EventLog

The below script  displays records from the event log which has an “error” state in the Application, System and Security logs.

PowerShell Read Event Logs

Parameter “-Newest 100” gives only latest 100 entries in event log. Continues…

PowerShell Tutorial – WMI Objects

Using WMI Objects in PowerShell

WMI, Windows Management Instrumentation is set of managed APIs provided by the Windows OS to expose information about local or remote computers.

You can use WMI objects from  PowerShell  by using the  Get-WMIObject cmdlet use to execute WMI objects as shown below

PowerShell WMI Objects

You can see the list of WMI objects available by executing Get-WMIObject -List as shown below:

PowerShell WMI Objects

More complex WMI queries such as the below example can be executed:

PowerShell WMI Objects

In the above query $QueryText is a variable which contains the WMI query which is similar to  a T-SQL style query.  This query extracts the logical disk information of C,D and G whereFreeSpace is greater than a certain value and the FileSystem is NTFS.

The below query gives the same result as above. Examine the way it has written, as it is a little different.

Get-WmiObject -Class
Win32_LogicalDisk | Where-Object {

 $_.DeviceID -eq "C:"
-or $_.DeviceID -eq "D:" -or $_.DeviceID -eq "G:"-and
$_.FreeSpace -gt 104857600 -and $_.FileSystem -eq "NTFS"} |

Personally I prefer the first version as it is more similar to T-SQL. Continues…

PowerShell Tutorial – CmdLets

In common with other scripting languages, in PowerShell   has basic language elements like Variables, Arrays, Functions, Objects, Loops, IF statements, Switch statements, etc. (See here for a full explanation)

PowerShell CmdLets (Commands)

In PowerShell  commands are known as CmdLets (pronounced Command Lets). Cmdlets follow the naming convention of Verb-Noun combination:

E.g: Get-Help, Get-Service, Get-Process

PowerShell cmdlets are not case sensitive and are the smallest unit of functionality in PS.  You can use either the PowerShell Integrated Script Environment shown below (just type powershell_ise into the search box in the Windows start menu to launch this) or the command line tool to execute Cmdlets.

PowerShell Tutorial

In the PowerShell ISE. you enter the command at the prompt and the results of the cmdlet will be displayed in the middle panel of the tool. You can use the top panel in the tool to write scripts and also to execute single Cmdlets. The F5 key executes the entire script while F8 key executes only highlighted Cmdlets (Run Selection).

PowerShell Tutorial

Cmdlets are simple to type, you can use Tab key to auto complete the Cmdlet. E.g: Type Get-Pro then press the Tab key.

Cmdlet parameters

Cmdlet accept  which are denoted by using the “-“symbol:

PowerShell Tutorial

For example, the “-Name” is the parameter instructs PowerShell to display only “winrm” service information. Parameters are  also  auto completed  using  the Tab key, so that you don’t have to remember the entire parameter name.


Piping or pipelining is a method of combining two or more PowerShell Cmdlets to do a single task. PowerShell is a fully objected oriented scripting language as a result Cmdlet   returns an object as result. To combine Powershell Cmdlets you can use the symbol, “|”.

PowerShell Tutorial

The Get-Service cmdlet returns all services (whatever the state) on the local machine. It returns as an object. The “|” or piping passes that object in to next cmdlet (where-object) which essentially does the filtering.  The braces “{ }” represents the body of the where-object cmdlet, whichs specifies a condition. “$_.Status” is the current object (“$_.”), property (“Status”) and “-eq” is the logical condition (ie “=”).
Operators   in PowerShell user characters and not as symbols as  in other languages.

The Where-object cmdlet iterates through all the objects returned from the Get-Service cmdlet and filters out only the objects which are have the status of “Running”.Continues…

Windows Server Core Installation

Server Core Prerequisites

Before installing Server Core you will need the following:

  • The original Windows Server 2008 or 2008 R2  installation media.
  • If you are using Windows Server 2008 you will need a  valid product key (installation can be completed on Windows Server 2008 R2 without a product key).
  • A machine for the  clean Server Core installation (note that there is currently no upgrade option for Server Core – only a new clean installation is available).
  • There is no way to upgrade from a . Only a clean installation is supported.
  • There is no way to upgrade from a Server Core installation to a full installation of Windows Server 2008. If you need the Windows® user interface or a server role that is not supported in a Server Core installation, you will need to install a full installation of Windows Server 2008.

Note that the only option for installing Server Core is a new clean installation, it is not possible to upgrade from a  full installation of Windows Server 2008 to a Server Core installation nor is it possible  to upgrade from any previous version of Windows Server  to  Server Core.

Installation Method 1 – Manually Install Server Core.

Follow the below procedure to install  Server Core:

  1. Insert the  Windows Server 2008 installation media in the DVD drive.
  2. The auto-run dialog will appear, click Install Now.
  3. Follow the stepped instructions  to complete the Server Core Setup.
  4. When Setup has completed, hit   CTRL+ALT+DELETE, click Other User, then type Administrator with a blank password, and hit ENTER. You will then be prompted to create a password for the Administrator account, and the installation will then be complete.

In Windows Server 2008 R2the setup procedure no longer prompts you for a product key.

IIS Application Pools for ASP.NET Apps

IIS Application Pools allow for grouping of similar or related applications to facilitate easy management and configuration. Each application assigned to an application pools (or app pool) is isolated from other apps so that issues in one pool do not impact apps in other pools. Applications which have similar performance profiles or which belong to the same department in the business can be grouped together.

IIS 7 automatically creates serveral application pools, including the default app pool which is used  when you create a new application. When you create  a new application, it is automatically  assigned to the default application pool (DefaultAppPool), and a previously deployed app can have its application pool changed (for a varierty of reasons such as to enable it to use a newer version of the .NET framework). Application pools can be created and managed  using IIS . In the IIS Management Console expand the server and select Application Pools. This lists the app pools currently set up on the server as shown below:

IIS Application Pools

Application pools set up in IIS

The application pool listing displays most of the key characteristics of each app pool:

  • Name : The name of the application pool which cannot be changed after it has been created.
  • Status : Whether the application pool is running or stopped.
  • .NET Framework Version : The .NET Framework version  which will  execute the code.
  • Managed Pipeline Mode : IIS  supports Integrated and Classic pipeline modes for handling requests.
  • Identity : The Windows account which runs the apps  in the pool.
  • Applications : The number of applications running in the pool.

Creating a New Application Pool

Create a custom application pool by  clicking the  Add Application Pool link from the right hand panel of the Application Pools screen.