Powershell script to change printer IP address
A question was posted in Powershell.org Q&A forum:
I have a weird question. Can you modify object properties. the command
Get-PrinterPort 192.* | fl *
prints out all the attributes of the printer port. but I can’t modify them. I don’t want to create a new port and start from scratch, just modify the existing object. Or maybe export the export and then import it, modified, into the new one.
This script does just that. It can be downloaded from the Microsoft Script Center Repository.
The reason we cannot modify the existing printer port object is that the Get-Printer commandlet uses the MSFT_TCPIpPrinterPort class. This class has the 2 properties we want to change (HostAddress and Name) but they’re read-only.
Even if we try to use the Win32_TCPIpPrinterPort class, as in:
$OldIP = “192.168.0.95”
$NewIP = “192.168.0.99”
$objPrinterPort = Get-WmiObject -Class Win32_TCPIpPrinterPort | Where-Object {$_.Name -eq “IP_$OldIP”}
$objPrinterPort.psbase.scope.options.EnablePrivileges = $true
$objPrinterPort.HostAddress = $NewIP
$objPrinterPort.Name = “IP_$NewIP”
$objPrinterPort.Put()
This does not modify the existing Printer Port, it creates a new one..
Example script usage:
.\Change-PrinterIP.ps1 192.168.0.95 192.168.0.99
Script output looks like:
Test-Disk powershell script to test disk IO performance
This script tests disk IO performance by creating random files on the target disk and measuring IO performance. The script can be downloaded from the Microsoft Script Center Repository. It leaves 2 files in the WorkFolder:
A log file that lists script progress, and
a CSV file that has a record for each testing cycle.
Warning:
This script will delete all subfolders in the work-folder. Make sure to run it in a new folder.
For help type in;
help .\Test-Disk.ps1 -full
Example .\Test-Disk.ps1 “i:\support” 3GB
This example tests the i: drive, generates files under i:\support, uses a maximum of 3GB disk space on i: drive. It runs a single thread, runs for 3 cycles, uses largest file = 100MB (1 order of magnitude below 3GB entered), smallest file = 10MB (1 order of magnitude below largest file)
Example .\Test-Disk.ps1 “i:\support” 11GB 8 5 4
This example tests the i: drive, generates files under i:\support, uses a maximum of 11GB disk space on i: drive, uses a maximum of 8 threads, runs for 5 cycles, and uses SamllestFile 100MB.
Script output looks like:
Setting up Azure Storage account for StorSimple array 5000 and 7000 series
StorSimple is an amazing Hybrid Storage array that extends on-prem storage seamlessly to the cloud. The 5000 and 7000 series models require the setup of a cloud storage account prior to array installation. To setup a storage account in Azure for StorSimple array:
- Log into you Azure Manage portal at https://manage.windowsazure.com/
You need to have at least one active Azure subscription before you start. - Click Storage on the left, then click New at the bottom:
- Type in a name for the new account you wish to create – must be lower case letter only. Pick an Azure data center – typically one that’s physically close to your location to get better latency. Pick a subscription. Pick a replication setting. Locally-redundant give you 3 copies of your data in the data center you selected. Geo-redundant gives you 3 additional copies in another Azure data center. Geo-redundant is typically twice the cost of locally-redundant storage account, is the default option, and is well worth the addition 2.25 cents per GB in my opinion.
In a minute or 2 Azure will finish creating the storage account. click on the account name:
- Next click Dashboard, and click Manage Access Keys at the bottom:
- Copy the account name and the primary access key. You will need them to setup your StorSimple array later.
Secure this information because it provides access to your Azure data. Data can be accessed by using either the primary or secondary keys. Each key is 88 characters long and is made up of alphanumeric upper and lower case letters and special characters. The availability of 2 keys allows us to change keys without any access interruption by applications or machines that use the account. For example in case of key compromise, and you’re using the primary key in an application or machine, you can:
- Regenerate the secondary key
- Replace the key in the script/application/machine using the storage account (no access interruption)
- Regenerate the primary key
Now you have changed your account keys without any service interruption
Note that this applies to StorSimple 5000 and 7000 series only. StorSimple 8000 series is setup differently. See this post for more details.
Powershell script to generate HTML report on files in given folders with specific extensions and size
11/03/2014 – v1.2
Added ‘Report run time’ at the bottom
Fixed bug when no files are found that match criteria
Turned into function
Bundled with EnhancvedHTML2
Added SizeUnit parameter
Screen output will look like:
The HTML report will look like:
A question was posted a few days ago on the Powershell.org Q&A forum:
I’m trying to get people to clean up old files. Never an easy job. To help them out, I want to generate reports of their department folders. One report would list their Powerpoint files, another PDFs and a third, zip files.
Many of us have been in this situation where data sprawl goes a bit out of control. This script helps produce HTML reports that can be customized to report on:
- Files in several folders,
- With specific file extensions,
- Greater than a specific file size,
- File properties reported on can also be customized
The script can be downloaded from the Microsoft Script Center Repository.
The script uses EnahncedHTML2 module which is written by Don Jones in 9/2013. I first met Don at TechEd 2014 in Houston where he delivered several sessions that I attended and enjoyed. In spite of being one of the leading experts on Microsoft business technologies, he’s a down to earth guy who would take the time to answer a question or help out when needed.
To install EnhancedHTML2 module:
- Download it from the Powershell.org public OneDrive. Look under the Creating HTML Reports folder.
- Check your Powershell Module Path. Run $env:PSModulePath.Split(“;”) for example:
- Create a folder named “EnhancedHTML2” under any of the listed paths like c:\Program Files\WindowsPowerShell\Modules\EnhancedHTML2
- Copy the 2 files EnhancedHTML2.psd1 and EnhancedHTML2.psm1 to this folder (part of the downloaded files from #1 above)
- Finally run Import-Module EnahncedHTML2
Add-Admin.ps1 powershell script to create local admin account on many computers
This script automates the task of creating a local admin account on many computers.
The script can be downloaded from the Microsoft TechNet Gallery
As usual the script leaves a log file on the same folder where it runs. It lists the steps taken and any error messages encountered.
The script works even if Script Execution Policy is Restricted on the target computers.
The script will fail if the password entered for the new local admin account does not meet the minimum password requirements on the target computers.
Word of caution: the new admin account password is saved in the log file which is created in the same folder where the script runs. This is a clear text file. It’s advisable to delete that log file, encrypt it, or move it to a secure folder.
Get-Busy.ps1 powershell script to create files on many PCs and collect metrics
This script uses Busy.ps1 which is a script that I posted earlier. This script can be downloaded from the Microsoft TechNet Gallery. To use this script you need to edit the 4 data entry lines on top:
- $WorkFolder = “e:\support” # Folder on each VM where test files will be created
- $MaxSpaceToUseOnDisk = 20GB # Maximum amount of disk space to be used on each VM’s $WorkFolder during testing
- $VMPrefix = “V-2012R2-LAB” # We’ll use that to scope this script (only running VMs with name matching this Prefix will be processed)
- $LocalAdmin = “administrator” # This is the local admin account on the VMs. You can also use a domain account here if you like.
The script requires 1 positional parameter to indicate whether you wish to start the testing on the VMs or stop it. For example to start:
.\get-busy.ps1 start
To end the testing, use:
.\get-busy.ps1 stop
The script will reach out to the VMs being tested and stop the busy.ps1 script, collect the test results, and cleanup the $Workfolder on each VM.
The script generates 2 log files:
- A general log file that contains the messages displayed on the screen about each action attempted.
- A CSV file that contains the compiled test results from all the CSV files generated by each busy.ps1 script on each of the tested VMs
Here’s an example of the compiled CSV file Get-busy_20140714_071428PM.csv
Powershell script to generate file read/write activity to test storage performance
This script generates file read/write activity to test storage performance. Set the $WorkFolder and $MaxSpaceToUseOnDisk variables on top to indicate the folder where test files will be created and maximum amount of disk space to be used on $WorkFolder during testing respectively.
The script can be run with the -verbose switch to show more information during processing, like:
.\busy2.ps1 -verbose
As the $WorkFolder exceed 90% of the capacity indicated by the $MaxSpaceToUseOnDisk variable, the scripts deletes all test files and starts a new cycle. the script can be stopped by clicking CTRL-C or setting the registry key HKLM:\Software\Microsoft\Busy to 0
The script includes a recursive function to generate seed files of (decimal) exponential sizes to be used for file copy activities.
The script generates 2 log files. The first one has details on the files created. The second one is a CSV file that has a record for every cycle the script goes through, including cycle duration, sum of generated file sizes, number of files generated on this cycle, average file size, disk throughput, IOPS,…
Here’s an example CSV file output:
Cycle # | Duration (sec) | Files (GB) | # of Files | Avg. File (MB) | Throughput (MB/s) | IOPS (K) | Machine Name | Start Time | End Time |
1 | 337.67 | 95.35 | 19 | 5138.85 | 289.15 | 4.63 | HV-LAB-05 | 07/10/2014 19:54 | 07/10/2014 20:00 |
The script can be downloaded from the Microsoft TechNet Gallery.
7/15/2014:
The script displays output to the screen like:
It also logs the same to a text file like Busy_HV-LAB-05.txt and enters the statistics in a CSV file like Busy_HV-LAB-05.csv
Powershell script to live migrate all running VMs including storage from one host to another
Powershell Script to live migrate all running VMs; including storage; from one host to another. Enter the source and destination host names (or IPs) in lines 4 and 5. Enter the drive letters of the destination host where you wish to live migrate the source host VMs to in line 6.
You can download this script from the Microsoft TechNet Gallery.
The script live migrates the VMs:
It also leaves 2 files on the folder where it runs:
– A log file that shows different information about the source and destination hosts, and the VMs being migrated.
– A CSV file that shows one record per migrated VM listing the source path of each of its disks. This may be useful for failback..
Powershell script to rename many computers and join them to AD domain
This script will go through all VMs on the current Hyper-V host, select those that match a given name pattern, rename them to match the VM Name (in Hyper-V), and join them to the domain.
The script can be downloaded from the Microsoft TechNet Gallery.
The script leaves a log file in the folder where it runs that shows details of actions performed and their success/failure status.
In the V1.1 update, I added code to initialize and format VM disks..
The VMs can be created in bulk as shown in this post.
This script needs a running VM acting as DC and DHCP server as shown in this post.
Using Powershell to create many Hyper-V Virtual Machines on many LUNs asynchronously
In a prior post I put out a powershell script to create many Hyper-V virtual machines on multiple LUNs using the Create-VM.ps1 script. That script ran in a single thread creating one VM before moving on to the next. In another post I manually ran 8 scripts to achieve the goal of running multiple jobs at the same time. In this script I use Start-Job with ScriptBlock and -ArgumentList to run multiple jobs at the same time.
The script can be downloaded from the Microsoft TechNet Gallery.
Hardware:
Compute node (Hyper-V host): 2x Xeon E5-2430L CPUs at 2 GHz with 6 cores each (12 Logical processors each) and 15 MB L3 cache, 96 GB RAM, 2x 10Gbps NICs that are not RDMA capable, setup in a NIC team (Teaming mode: Switch Independent, Load balancing mode: Hyper-V Port). Storage is 4x LUNs from a 3-node Gridstore array. Each LUN is configured as IOPS 2+1 LUN. Each Gridstore storage node has 1x Xeon E5-2403 processor at 1.8GHz with 4 cores (no hyper-threading) and 10 MB L3 cache, 32GB DDR3 1333 MHz DIMM, 4x 3TB 7200 RPM SAS disks, a 550GB PCIe Flash card, and 2x 10Gbps NICs that are not RDMA capable, setup in a NIC team (Broadcom Smart Load Balancing and Failover = switch-independent, no LACP support needed on switch).
The script took 9 minutes and 45 seconds to create the 40 VMs. During that time the Hyper-V host resource monitor showed:
GridControl snap-in showed:
I cal also see script logs piling up during script execution:
I started the 40 VMs manually after the script finished:
This excel file is based on the script output summary CSV file.
Conclusion and important points to note:
- Hyper-V performance summary: No CPU or memory bottleneck observed during the test.
- Array performance summary:
- Files copies: 40
- File size: 8.93GB
- Concurrent operations: 4 copy operations at the same time
- Total vLUNs used: 4
- Average file copy duration: 10.18 seconds
- Average throughput: 902.86 MB/s (6 Gbps)
- Using the formula IOPS = BytesPerSec / TransferSizeInBytes
LUNs are formatted as 64 KB blocks
Average IOPS = (902.86*1024)/64 = 14.45k IOPS
- Although 20 Gbps aggregate bandwidth is available to each of the compute node and the 3 storage nodes, I have not been able to produce network traffic above 10 Gbps.
- CPU on the storage nodes was around 90% during the copy. The storage nodes can benefit from additional processing capacity.
Setting up Hyper-V lab using Powershell
In this post I setup a Hyper-V lab to test VM performance on Gridstore enterprise storage array.
Hardware: Compute node (Hyper-V host): 2x Xeon E5-2430L CPUs at 2 GHz with 6 cores each (12 Logical processors) and 15 MB L3 cache, 96 GB RAM, 2x 10Gbps NICs that are not RDMA capable. Storage is 8x LUNs from a 6-node Gridstore array detailed in this post.
I have Hyper-V role installed on this server. Next I setup NIC team and a vSwitch using this script:
# Script to create NIC team, vSwitch
# Sam Boutros
# 6/28/2014
#
$PhysicalNICs = “NIC1,NIC2” # Get these names from Get-NetAdapter command
$NICTeamName = “Team1”
$vSwitchName = “My_vSwitch” # Pick a name for your vSwitch
$ParentPartitionvNICName = “My_vNIC” # Pick a name for your PP vNIC
$VLAN = 19
# End Data Entry section
#
# Create NIC Team
New-NetLbfoTeam -Name $NICTeamName -TeamMembers $PhysicalNICs -LoadBalancingAlgorithm HyperVPort -TeamingMode SwitchIndependent
# Create vSwitch
New-VMSwitch -Name $vSwitchName -NetAdapterName $NICTeamName -AllowManagementOS $False -MinimumBandwidthMode Weight
Set-VMSwitch $vSwitchName -DefaultFlowMinimumBandwidthWeight 50
# Create vNIC on this new vSwitch for the parent partition (Hyper-V host OS)
Add-VMNetworkAdapter -ManagementOS -Name $ParentPartitionvNICName -SwitchName $vSwitchName
# Comment out the following line if you’re not using VLANs
Set-VMNetworkAdapterVlan -ManagementOS -VMNetworkAdapterName $ParentPartitionvNICName -Access -VlanId $VLAN
Using a previously sys-prepped server 2012 R2 VHDX file (golden image), I manually create a VM to be used as DC for new lab test domain and DHCP server.
Install Active Directory Domain Services, DNS server, and DHCP server roles.
Configure Active Directory: new forest, new domain, forest level and domain level: 2012 R2, reboot.
Authorize DHCP server:
Create, configure, and activate new DHCP scope:
I got/set the MAC addresses to be given out by my Hyper-V host:
I added an Allow Filter to ensure that this DHCP server gives out IPs to the VMs of this host only and not any other machine in VLAN 19:
Now we’re ready to spin some VMs!
See this post for a script to create many VMs in bulk.
And this post for renaming them and joining them to the domain.
Using Powershell to create many Hyper-V Virtual Machines in parallel on Gridstore array
In a prior post I put out a powershell script to create many Hyper-V virtual machines on multiple LUNs using the Create-VM.ps1 script. That script ran in a single thread creating one VM before moving on to the next. In this test of the Gridstore array I ran 8 scripts at the same time in parallel.
# Script to create 8 test VMs on a specific LUN on current HyperV Host at a fixed point in time.
# Uses Create-VM.ps1 from https://superwidgets.wordpress.com/category/powershell/
# Sam Boutros – 7/1/2014
#
$GoTime = 40 # minute
$VMPrefix = “V-2012R2-LABk”
$VMrootPath = “k:\VMs”
$NumberofVMs = 8 # Per target LUN
#
# Common variables
$VMG = 2
$VMMemoryType = “Dynamic”
$VMStartupRAM = 1GB
$VMminRAM = 512MB
$VMmaxRAM = 1GB
$vSwitch = “Gridstore_vSwitch”
$VMCores = 2
$VLAN = 19
$AdditionalDisksTotal = 2
$AdditionalDisksSize = 1TB
$GoldenImageDiskPath = “E:\Golden\V-2012R2-3-C.VHDX”
$CSV = (Get-Location).path + “\IOPS_” + (Get-Date -format yyyyMMdd_hhmmsstt) + “.csv”
#
Write-Output “Waiting to start at the $GoTime minute”
do {start-sleep 1} until ((Get-Date).Minute -eq $GoTime) # Wait until GoTime
For ($j=1; $j -lt $NumberofVMs+1; $j++) {
$VMName = $VMPrefix + $j
$VMFolder = $VMRootPath + “\” + $VMName
.\Create-VM.ps1 -VMName $VMName -VMFolder $VMFolder -VMG $VMG -VMMemoryType $VMMemoryType -VMStartupRAM $VMStartupRAM -VMminRAM $VMminRAM -VMmaxRAM $VMmaxRAM -vSwitch $vSwitch -VMCores $VMCores -VLAN $VLAN -AdditionalDisksTotal $AdditionalDisksTotal -AdditionalDisksSize $AdditionalDisksSize -GoldenImageDiskPath $GoldenImageDiskPath -CSV $CSV
Start-VM -Name $VMName
}
The other 7 scripts were identical, except for the last letter of the $VMPrefix and the drive letter of the $VMRootPath.
The line do {start-sleep 1} until ((Get-Date).Minute -eq $GoTime) ensures that all 8 scripts kick off within 1 second of each other, essentially starting at the same time.
The Hyper-V host was clearly stressed:
The GridControl snap-in showed CPU utilization on the Gridstore storage nodes was holding around 60%:
Write process on the storage nodes hits all 6 nodes:
Read requests hit 4 storage nodes:
Here’s a copy of the metrics summary script output.
One of the 8 scripts had an error:
The error was that the script tried to create VM too fast. The interesting thing here is the magenta error message in this screen shot. It’s from an error handling code in the Create-VM.ps1 script. The script log file Create-VM_V-2012R2-LABk2_20140701_034214PM.txt showed:
2014.07.01 03:42:14 PM: Starting with paramters:
2014.07.01 03:42:14 PM:
2014.07.01 03:42:14 PM: VMName: V-2012R2-LABk2
2014.07.01 03:42:14 PM: VMFolder: k:\VMs\V-2012R2-LABk2
2014.07.01 03:42:14 PM: vSwitch: Gridstore_vSwitch
2014.07.01 03:42:14 PM: GoldenImageDiskPath: E:\Golden\V-2012R2-3-C.VHDX
2014.07.01 03:42:14 PM: VMG: 2
2014.07.01 03:42:14 PM: VMMemoryType: Dynamic
2014.07.01 03:42:14 PM: VMStartupRAM: 1073741824 – VMStartupRAM (calculated):
2014.07.01 03:42:14 PM: VMminRAM: 536870912 – VMminRAM (calculated):
2014.07.01 03:42:14 PM: VMmaxRAM: 1073741824 – VMmaxRAM (calculated):
2014.07.01 03:42:14 PM: VMCores: 2 – VMCores (calculated):
2014.07.01 03:42:14 PM: VLAN: 19 – VLAN (Calculated):
2014.07.01 03:42:14 PM: AdditionalDisksTotal: 2 – AdditionalDisksTotal (calculated):
2014.07.01 03:42:14 PM: AdditionalDisksSize: 1099511627776 – AdditionalDisksSize (Calculated): 1099511627776
2014.07.01 03:42:14 PM: .
2014.07.01 03:42:14 PM: Creating VM with the following paramters:
2014.07.01 03:42:14 PM: VM Name: ‘V-2012R2-LABk2’
2014.07.01 03:42:14 PM: VM Folder: ‘k:\VMs\V-2012R2-LABk2’
2014.07.01 03:42:14 PM: VM Generation: ‘2’
2014.07.01 03:42:14 PM: VM Memory: Dynamic, Startup memory: 1,024 MB, Minimum memory: 512 MB, Maximum memory: 1,024 MB
2014.07.01 03:42:14 PM: vSwitch Name: ‘Gridstore_vSwitch’
2014.07.01 03:42:14 PM: VM CPU Cores: ‘2’
2014.07.01 03:42:14 PM: Copying disk image k:\VMs\V-2012R2-LABk2\V-2012R2-LABk2-C.VHDX from goldem image E:\Golden\V-2012R2-3-C.VHDX
2014.07.01 03:42:41 PM: Copy time = 0 : 27 : 762 (Minutes:Seconds:Milliseconds) – 00:00:26.7623983 Milliseconds
2014.07.01 03:42:41 PM: File k:\VMs\V-2012R2-LABk2\V-2012R2-LABk2-C.VHDX size: 9,148 MB (9592373248 bytes)
2014.07.01 03:42:41 PM: Throughput: 342 MB/s (341.822877660408 MB/s)
2014.07.01 03:42:41 PM: or: 2,735 Mbps (2734.58302128326 Mbps)
2014.07.01 03:43:32 PM:
2014.07.01 03:43:32 PM: Error: Failed to create VM ‘V-2012R2-LABk2’.. stopping
2014.07.01 03:43:32 PM: Error details: The operation cannot be performed while the virtual machine is in its current state.[The operation cannot be performed while the virtual machine is in its current state..count-1]
Windows event viewer search showed:
So it appears that this “k” script working to create 8 VMs on drive “K” sent New-VM request at 3:43:32 (line 303 of CreateVM.ps1). That request took 11 seconds to complete as shown in event ID 13002 above. In the mean time, the script’s subsequent error checking lines 304, 305 detected that the VM has not bean created and aborted execution as designed.
On another note, I’m sure there are better ways to run powershell commands or scripts in parallel. I’ve looked into The [RunspaceFactory] and [PowerShell] Accelerators while running powershell in Multithreaded Apartment (powerhsell.exe -mta). I’ve also tried Updated Type Accelerator functions for PowerShell 3.0 and 4.0. I have tried the Start-Job/Get-Job cmdlets with script blocks, but had hard time passing parameters to Create-VM.ps1 with $ScriptBlock and -ArgumentList. I’ve also looked into ForEach-Parallel powershell workflow command. I simply needed to get this testing done quickly and did not have time to find a better way to run tasks in parallel in powershell. I welcome any comments or suggestions on better ways to run powershell scripts in parallel.
Conclusion and important points to note:
- This set of scripts ran tasks that attempted to create 64 VMs on 8 Gridstore vLUNs. It did so by running 8 scripts in parallel, each script attempted to create 8 VMs on a different vLUN. 55 VMs were created successfully. Script failures were tracked down to busy/overwhelmed physical host.
- Similar to the last test, each of the 8 vLUNs is configured as an IOPS (2+1) LUN
- Network bandwidth utilization was completely maxed out on the testing Hyper-V host (10 Gbps Ethernet) I will use NIC teams to provide 20 Gbps Ethernet bandwidth
- Storage nodes’ CPU utilization was at around 60% in this test, which is not a bottleneck.
- This test is essentially a disk copy test as well and not a Hyper-V virtual machine performance test.
- Summary comparison between this and the last test:
The throughput values under Gbps and GB/Min. are meant to compare parallel versus serial execution testing and not as metrics for the storage array, because they include time to create and configure virtual machines in addition to time taken by disk operations.
Using Powershell to create 64 Hyper-V Virtual Machines on Gridstore array
This script uses another script Create-VM.PS1 from a prior post. It creates 64 Hyper-V virtual machines on 8 different LUNs. It creates them synchronously (one after the other). The 8 LUNs are on a 6 node GridStore array using H-nodes. Details of the Gridstore array setup are in this post.
# Script to create 64 test VMs on 8 diffent LUNs on current HyperV Host
# Uses Create-VM.ps1 from https://superwidgets.wordpress.com/category/powershell/
# Sam Boutros – 7/1/2014
#
$VMPrefix = “V-2012R2-LAB”
$VMG = 2
$VMMemoryType = “Dynamic”
$VMStartupRAM = 1GB
$VMminRAM = 512MB
$VMmaxRAM = 1GB
$vSwitch = “Gridstore_vSwitch”
$VMCores = 2
$VLAN = 19
$AdditionalDisksTotal = 2
$AdditionalDisksSize = 1TB
$GoldenImageDiskPath = “E:\Golden\V-2012R2-3-C.VHDX”
$CSV = (Get-Location).path + “\IOPS_” + (Get-Date -format yyyyMMdd_hhmmsstt) + “.csv”
$VMFirstNumber = 1 # Starting number
$TargetLUNs = @(“e”,”g”,”h”,”i”,”j”,”k”,”l”,”m”)
$NumberofVMs = 8 # Per target LUN
#
foreach ($LUN in $TargetLUNs) {
$VMrootPath = $LUN + “:\VMs”
For ($j=$VMFirstNumber; $j -lt $NumberofVMs+$VMFirstNumber; $j++) {
$VMName = $VMPrefix + $j
$VMFolder = $VMRootPath + “\” + $VMName
.\Create-VM.ps1 -VMName $VMName -VMFolder $VMFolder -VMG $VMG -VMMemoryType $VMMemoryType -VMStartupRAM $VMStartupRAM -VMminRAM $VMminRAM -VMmaxRAM $VMmaxRAM -vSwitch $vSwitch -VMCores $VMCores -VLAN $VLAN -AdditionalDisksTotal $AdditionalDisksTotal -AdditionalDisksSize $AdditionalDisksSize -GoldenImageDiskPath $GoldenImageDiskPath -CSV $CSV
Start-VM -Name $VMName
}
$VMFirstNumber += $NumberofVMs
}
During the script execution the Hyper-V resource monitor showed the following:
The GridControl snap-in showed:
I can also see the VMs popping up in Hyper-V Manager:
and their files in the file system:
This file is derived from the script’s CSV file output.. It shows:
Conclusion and important points to note:
- Script ran in serial, creating 1 VM on 1 LUN, and after that’s done moving on to the next VM on the same LUN, then moving on to the next LUN.
- Each LUN is configured as an IOPS (2+1) LUN. So, every write process is writing to 3 disks out of the array 24 total disks (whereas a read process reads from 2 disks in the LUN). Additional throughput is likely to be achieved by testing scenarios where we’re writing to all 8 LUNs simultaneously hitting 18 of the array disks at the same time.
- Network bandwidth utilization is at about 68.2% capacity of the 10 Gbps Ethernet used in this test. for the next test (in parallel) I will use NIC teams to provide 20 Gbps Ethernet bandwidth
- Storage nodes’ CPU utilization was at around 50% in this test, which is not a bottleneck.
- This test is essentially a disk copy test and not a Hyper-V virtual machine performance test. Hyper-V testing with Gridstore will be shown in a future post.
- Using the formula IOPS = BytesPerSec / TransferSizeInBytes
LUNs are formatted as 64 KB blocks
Average IOPS = (852.5*1024)/64 = 13.64k IOPS