AWS Cloud Operations & Migrations Blog

Assess secure Windows Servers for TCO analysis using Migration Evaluator

Summary

In this blog post, we explore an approach that leverages Windows operating system tools to extract critical metric data directly from Windows Servers. At Amazon Web Services (AWS), we offer the Migration Evaluator agentless collector and AWS Application Discovery Service to facilitate workload discovery. However, some customers run highly secure workloads where deploying assessment tools, enabling remote access or monitoring protocols such as SNMP and WMI are not feasible.

Solution overview

To retrieve Windows Server metrics, we will leverage native Windows services such as PowerShell and Performance Monitor. PowerShell scripts can retrieve provisioning data such as CPU, memory, disk capacity as well as operating system licensing information. Additionally, we will also extract performance metrics using Performance Monitor, focusing on CPU and memory utilization. By combining these results, we can provide data for the Migration Evaluator Data Import Template to proceed with a complimentary cost assessment. By doing so, you can confidently right size your AWS resources, ensuring optimal performance and cost efficiency. See the following sample business case report that was generated from Migration Evaluator.

This solution encompasses three parts for the assessment. Part 1 and 2 retrieve provisioning and utilization data are for a single server and need to be repeated for each server.

  • Part 1 – Server provisioning details retrieval using PowerShell.
  • Part 2 – CPU and memory utilization measurement with Windows Performance Monitor.
  • Part 3 – Rightsizing assessment using the Migration Evaluator Data Import Template.

Prerequisites

To perform the assessment using the Migration Evaluator, there are three prerequisites.

  • Request an assessment. Begin by requesting an assessment to access the Migration Evaluator console (Figure 1).

Figure 1. Request form of migration assessment

  • Validate PowerShell version on your environment. The provided PowerShell script has been validated on PowerShell version 5.1 and 7.4. If your environment uses a different PowerShell version that has not yet been validated, the script will display a warning message asking for confirmation before execution.
  • Download a Migration Evaluator Data Import Template file. The template file link is available from either Migration Evaluator Console after assessment requested and login permission granted or from Migration Evaluator resource page under the section Data Import Template.

Walkthrough

Part 1 – Server provisioning details retrieval using PowerShell

To retrieve the provisioning data details of Windows Servers, you can utilize PowerShell. This process allows you to gather information such as server name, CPU, memory, disk capacity, and the operating system.

1. Create the PowerShell script.

a) Save the following code snippet as a file named get_provisioning.ps1 in the user directory on the source server. This PowerShell script is to retrieve provisioning data from Windows Server.

# Validate Powershell version qualified for version 5.1 or 7.4, if not then show warning message.
[string]::Concat("[INFO]Powershell version " , $PSVersionTable.PSVersion.Major, ".", $PSVersionTable.PSVersion.Minor, " detected in your environment.")
if  ( -not ( ( ( 5 -eq $PSVersionTable.PSVersion.Major ) -and ( 1 -eq $PSVersionTable.PSVersion.Minor ) ) -or
             ( ( 7 -eq $PSVersionTable.PSVersion.Major ) -and ( 4 -eq $PSVersionTable.PSVersion.Minor ) ) ) ) 
{
  [string]::Concat("[WARNING]Powershell version 5.1 or 7.4 is supported, for other Powershell versions it is not validated.")
  $confirmation = Read-Host "Not a validated Powershell version, Are you Sure You Want To Proceed? [y/n]"
  while($confirmation -ne "y")
  {
    if ($confirmation -eq 'n') {exit}
    $confirmation = Read-Host "Not a validated Powershell version, Are you Sure You Want To Proceed? [y/n]"
  }
}

# Retrieve Server Name/CPU Cores/Memory/Storage/OS etc. provisioning metrics
try {
  $Server_Name                   = hostname
  $CPU_Cores                     = (Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors
  [int]$Memory_MB                = (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1GB * 1024
  $Storage                       = Get-CimInstance -ClassName Win32_LogicalDisk | ? {$_. DriveType -eq 3}    # 3:'Local Disk'
  [int]$Provisioned_Storage_GB   = 0
  [int]$Free_Storage_GB          = 0
  foreach ($s in $Storage){
    $Provisioned_Storage_GB      = $s.Size / 1GB + $Provisioned_Storage_GB
    $Free_Storage_GB             = $s.FreeSpace / 1GB + $Free_Storage_GB
  }
  $Storage_Type                  = (Get-PhysicalDisk | Select FriendlyName, MediaType).MediaType
  $Operating_System              = (Get-CimInstance Win32_OperatingSystem).Caption
  $Is_Virtual?                   = "please update value to FALSE/TRUE"
  $Cpu_String                    = (Get-CimInstance Win32_processor).Name
}
catch {
  Write-Error "[ERROR]Failed to fetch part of metrics, please try to break down command to row to solve the error first."
  Exit
}

# Print out the detected provisioning information to terminal screen
[string]::Concat("Server Name             :" , $Server_Name)
[string]::Concat("CPU Cores               :" , $CPU_Cores)
[string]::Concat("Memory (MB)             :" , $Memory_MB)
[string]::Concat("Provisioned Storage (GB):" , $Provisioned_Storage_GB)
[string]::Concat("Used Storage (GB)       :" , $Provisioned_Storage_GB - $Free_Storage_GB)
[string]::Concat("Storage Type            :" , $Storage_Type)
[string]::Concat("Operation System        :" , $Operating_System)
[string]::Concat("Is_Virtual?             :" , $Is_Virtual?)
[string]::Concat("CPU String              :" , $Cpu_String)	

# Export detected provisioning information to CSV file
$data = @(
  [PSCustomObject]@{
    "Server Name"                 = $Server_Name
    "CPU Cores"                   = $CPU_Cores
    "Memory (MB)"                 = $Memory_MB
    "Provisioned Storage (GB)"    = $Provisioned_Storage_GB  
    "Operating System"            = $Operating_System
    "Is Virtual?"                 = $Is_Virtual?
    "Hypervisor Name"             = ""
    "Cpu String"                  = $Cpu_String
    "Environment"                 = ""
    "SQL Edition"                 = ""
    "Application"                 = ""
    "Cpu Utilization Peak (%)"    = ""
    "Memory Utilization Peak (%)" = ""
    "Time In-Use (%)"             = ""
    "Annual Cost (USD)"           = ""
    "Storage Type"                = $Storage_Type
    "Used Storage (GB)"           = $Provisioned_Storage_GB - $Free_Storage_GB
    }
)

try {
  $OutFile = [string]::Concat($Server_Name , "_Provisioning.csv")
  [string]::Concat("OutFile:" , $OutFile)

  if (!(Test-Path $OutFile)) {
    New-Item -Path $OutFile -ItemType File
  }

  $data | Export-Csv -Path $OutFile -NoTypeInformation
}
catch {
  Write-Error "[ERROR]Error occured while trying to export data to CSV file"
  Exit
}

2. Run the PowerShell script.

a) Open PowerShell with administrative privileges.

b) Navigate to the directory where you saved the script file get_provisioning.ps1 and run the script (Figure 2).

Figure 2. PowerShell script execution with administrator role

3. Review and update the output.

a) A CSV file named {server_name}_provisioning.csv will be generated in the same user directory. The file name will be composed by the actual server name.

b) Review the collected provisioning metrics in the CSV file (Figure 3).

Figure 3. Sample CSV output with provisioning metrics

c) The column Is Virtual? needs to be updated correctly according to the customer’s actual environment settings.

d) The column Storage Type may not be populated to value SSD or HDD. If multiple drives exist and the C drive is SSD and the D drive is HDD, then the value will be SSD HDD, we recommended correcting the value manually.

e) The column Used Storage (GB) value will be ignored as Migration Evaluator by default will use 50% utilization of the provisioned storage to estimate the storage cost. To use the actual used storage values, clarify this requirement with the AWS team.

Part 2 – CPU and memory utilization measurement with Windows Performance Monitor

We will utilize Windows Performance Monitor to collect utilization data using performance counters. These counters track various system metrics. To effectively estimate your resource requirements, we recommend collecting utilization data during the peak workload period and over a typical workload cycle to account for variations. These insights will aid in determining the appropriate resources during the rightsizing exercise.

1. Create a new data collector set.

a) Open Windows Performance Monitor with administrative privileges.

b) In the left pane, select Data Collector Sets.

c) In the right pane, right-click User Defined, select New, and then select Data Collector Set.

d) In the Create new Data Collector Set wizard, enter a name for the data collector set. For example, Migration Evaluator Data Import Template Data Set.

e) Select Create manually (Advanced) and then select Next.

f) Under Create data logs, select Performance counter, and select Next.

2. Select performance counters (Figure 4).

a) Set the sample interval to 9 Minutes. This aligns with Migration Evaluator collector setting, but you can define your own collection interval.

b) Select Add.

c) Select performance counters % Processor Utility under Processor Information section and % Committed Bytes In Use under Memory section on the list.

Figure 4. Setting performance counters in Windows Performance Monitor

d) Select Add, select OK and then Next.

3. Save and run the data collector set.

a) Browse to the directory where you want to store the data and then select Next. You might want to store the data on a network file share in order to aggregate the collected data in a central place.

b) Select Finish.

c) In the left pane of the main Performance Monitor window, expand the User Defined menu and select the data collector set that you created.

d) In the right pane, right-click the performance counter DataCollector01 and then select Properties.

e) Select Comma separated as the log format and then select OK.

f) In the left pane, right-click the name of the data collector set that you created and then select Properties.

g) Under the Stop Condition tab, select Overall Duration and set duration to 7 days as the recommended period of data collection. This will stop the collector automatically, but you can define your own collection period. Then, select OK.

h) In the left pane, right-click the name of the data collector set that you created and select Start. The Windows Performance Monitor tool starts monitoring your server and storing information in the specified location.

4. Verify the collected data (Figure 5).

a) Navigate to the folder where the performance log data is stored.

b) Open the CSV file to verify the collected metrics data from the performance counters.

Figure 5. Sample CSV output from performance counters 

Part 3 – Rightsizing assessment using the Migration Evaluator Data Import Template

After collecting data using native mechanisms of PowerShell and Performance Monitor, you will aggregate these provisioning and utilization data into Migration Evaluator Data Import Template for each server. Finally, share the completed Data Import Template with AWS to process the Migration Evaluator assessment report.

1. Aggregate collected data into Migration Evaluator Data Import Template.

We will introduce a basic way below to aggregate data by using Microsoft Excel, to aid in understanding how Migration Evaluator handle these metrics. If you have multiple server data to be aggregated, you can put your collected provisioning data and utilization data into two separate folders, compress the files and upload the compressed file to Migration Evaluator Console for AWS to consolidate.

a) Open the provisioning data CSV file introduced in Part 1 for each server using Microsoft Excel, copy and paste each server’s data to the Migration Evaluator Data Import Template with the download method described in Prerequisites section.

b) Open the utilization data CSV file introduced in Part 2 using Microsoft Excel, aggregate the per server’s utilization data in the following way.

 i. Sort the column in utilization data csv file to identify the P95 of CPU/Memory utilization. For example, there are 100 records. The 95th record after sorting the % Committed Bytes In Use column ascending will be the Memory P95 utilization and the 95th record after sorting the % Processor Utility column ascending will be the CPU P95 utilization.

 ii. Calculate the Time In-Use metrics by identifying the percentage of records where the CPU utilization is above 5%. For example, there are 100 records and 20 records in the % Processor Utility column are with value greater than 5%, then percentage of Time In-Use during full collection period is 20%.

c) Update the following utilization columns in the Data Import Template file prepared with the same server:

    • CPU Utilization Peak (%).
    • Memory Utilization Peak (%).
    • Time In-Use (%).

2. Finalize and share the Migration Evaluator Data Import Template with AWS

a) If applicable, update additional columns, such as SQL Edition based on the Data Import Template’s glossary guidance.

b) Upload the fully populated template containing data for all servers to Migration Evaluator Console.

c) The Migration Evaluator team will promptly provide the assessment report within days assuming no data is missing.

Cleanup

In Part 2, you implemented a mechanism to stop the data collection automatically but this will not clean up the data collector. To delete the data collector explicitly, open the Windows Performance Monitor with administrative privileges and right-click the name of the data collector, select Delete.

Conclusion

The key to rightsizing your Windows workloads lies in utilizing precise data. In this post, we demonstrated how to retrieve metrics data without deploying an assessment tool on Windows workloads. Additionally, we illustrated how you can incorporate this data into the Migration Evaluator Data Import Template file for a directional cost estimate that is based on accurate provisioning and utilization data.

While we introduce this solution for Windows Servers workloads where deploying assessment tools or enabling remote access or standard monitoring protocols is not possible, customers will need to run PowerShell scripts and configure the Performance Monitor to collect the required data. We recommend considering the deployment of the Migration Evaluator agentless collector tool if there are no blockers. Doing so will provide highly accurate metrics data and using standard protocols over the network, enabling collection from thousands of servers with minimal effort. For more information, please refer to the Migration Evaluator Resource page.

 

 

About the authors:

Wang Wei

Wang is a Solutions Architect at AWS supporting customers of all shapes and sizes with their migration cost assessment to AWS. Wang joined AWS in 2021 with a background in application development and technical support. Outside of work, he enjoys reading and travelling.

Angus Tong

Angus is a Migration Solutions Architect at Amazon Web Services. He is experienced in datacenter and cloud-to-cloud migration. Angus supports end-to-end migration and modernisation journey with in-depth discovery analysis and directional migration strategies.