Remote Server Administration Toolkit For Windows 8.1

Microsoft has released the RSAT for Windows 8.1.  This is the toolkit you will install on administrators’ Windows 8.1 PC to manage Windows Server 2012 R2 (WS2012 R2) and older.

Remote Server Administration Tools for Windows 8.1 Preview includes Server Manager, Microsoft Management Console (MMC) snap-ins, consoles, Windows PowerShell cmdlets and providers, and command-line tools for managing roles and features that run on Windows Server 2012 and Windows Server 2012 R2 Preview. In limited cases, the tools can be used to manage roles and features that are running on Windows Server 2008 R2 or Windows Server 2008. Some of the tools work for managing roles and features on Windows Server 2003.

EDIT: The link for this package from the below support matrix still points to the RSAT Preview.  I guess it will get updated soon. The link was updated (reused) to the GA bits.

There are a few important support notes:

  • The IP Address Management (IPAM) console should not be used (not supported) to manage WS2012.
  • The WS2012 R2 and Windows 8.1 PowerShell cmdlets should not be used to manage WS2012.  It is not blocked, but it is not supported.  It is supported to manage WS2012 Hyper-V using the Hyper-V GUI tools (FCM and Hyper-V Manager) from RSAT for Windows 8.1.
  • To manage WS2012 iSCSI target using PowerShell on Windows 8.1 then you must import the WS2012 (RSAT for Windows 8) PowerShell module.

Yes, I agree; This is very messy.

A support matrix for RSAT for Windows 8 and RSAT for Windows 8.1 has also been posted.

You’ll not that some tools are not in RSAT for Windows 8.1, and some are specifically listed as deprecated:

  • SMTP Server Tools: Not included.
  • Storage Explorer Tools: Not included.
  • Storage Manager for Storage Area Network (SAN) Tools: No included.
  • Windows System Resource Manager Tools: Deprecated and not in WS2012 R2.

Setting SMB 3.0 Bandwidth Limits In WS2012 R2

Windows Server 2012 R2 features SMB 3.0, not just for storage, but also for Live Migration.  In a converged network/fabric scenario we need to be able to distinguish between the different kinds of SMB 3.0 traffic to ensure that, for example, Live Migration does not choke off storage on a host.

This is possible thanks to a new feature called SMB Bandwidth Limit.  You can add this feature in Server Manager.

image

You can also add this feature via PowerShell:

Install-WindowsFeature FS-SMBBW

From there, we can use Set-SMBBandwidthLimit to set a Bytes Per Second limitation on three different kinds of SMB traffic:

  • Default
  • VirtualMachine
  • LiveMigration

For example, I could run the following to limit the bandwidth of Live Migration.  The minimum speed limit is used in this example, which is roughly 0.8 Gbps:

Set-SMBBandwidthLimit -Category LiveMigration -BytesPerSecond 1048576

Get-SMBBandwidthLimit will return the results and Remove-SMBBandwidthLimit will remove the limiter. 

The updated PowerShell help in the preview release of WS2012 R2 has not got much information on these cmdlets yet.

Build WS2012 R2 Storage Pools, Virtual Disks, And CSVs Using PowerShell

I’ve been building, tearing down, and rebuilding Storage Spaces in the lab over and over, and that will continue for the next few years Smile Rather than spend a significant percentage of my life clicking on wizards, I decided to script what I want done.

The below script will:

  • Build a storage pool from all available disks
  • Prep 2 storage tiers from SSD and HDD
  • Create 3 different virtual disks with different configs (customize to your heat’s content!)
  • Then run the PrepCSV function to turn those virtual disks into CSVs just the way I like them

How do I like a CSV?  I like them formatted Smile and the names consistent all the way: virtual disk, cluster resource name, volume label, and CSV mount point in C:ClusterStorage.  None of that “Cluster Disk (X)” or “Volume 1” BS for me, thank you.

It might be possible to clean up the stuff in the function.  This is what I have working – it works and that’s the main thing.  There’s a lot of steps to get disk ID so I can create and format a volume, and then bring the disk back so I can turn it into a CSV.

What’s missing?  I have not added code for adding the SOFS role or adding/configuring shares.  I’m not at that point yet in the lab.

Function PrepCSV ($CSVName)
{
#Rename the disk resource in FCM
(Get-ClusterResource | where {$_.name -like “*$CSVName)”}).Name = $CSVName

#Get the disk ID
Stop-ClusterResource $CSVName
$DiskID = (Get-VirtualDisk -FriendlyName $CSVName).UniqueId
Start-ClusterResource $CSVName

#Format the disk
Suspend-ClusterResource $CSVName
Get-disk -UniqueId $DiskID | New-Partition -UseMaximumSize | Format-Volume -FileSystem NTFS -NewFileSystemLabel “$CSVName” -Confirm:$false
Resume-ClusterResource $CSVName

#Bring the CSV online
Add-ClusterSharedVolume -Name $CSVName
$OldCSVName = ((Get-ClusterSharedVolume $CSVName).SharedVOlumeInfo).FriendlyVolumeName
Rename-Item $OldCSVName -NewName “C:ClusterStorage$CSVName”
}

# The following Storage Pool and Virtual Disk cmdlets taken from Bryan Matthew’s TechEd  …
# … Session at http://channel9.msdn.com/Events/TechEd/Europe/2013/MDC-B217#fbid=TFEWNjeU9XP

# Find all eligible disks
$disks = Get-PhysicalDisk |? {$_.CanPool -eq $true}

# Create a new Storage Pool
New-StoragePool -StorageSubSystemFriendlyName “Clustered Storage Spaces on Demo-FSC1” -FriendlyName “Demo-FSC1 Pool1” -PhysicalDisks $disks

# Define the Pool Storage Tiers
$ssd_tier = New-StorageTier -StoragePoolFriendlyName “Demo-FSC1 Pool1” -FriendlyName SSD_Tier -MediaType SSD
$hdd_tier = New-StorageTier -StoragePoolFriendlyName “Demo-FSC1 Pool1” -FriendlyName HDD_Tier -MediaType HDD

 

#Transfer ownership of Available Storage to current node to enable disk formatting

Move-ClusterGroup “Available Storage” -Node $env:COMPUTERNAME

 

# Creation of a 200 GB tiered virtual disk with 5 GB cache
New-VirtualDisk -StoragePoolFriendlyName “Demo-FSC1 Pool1” -FriendlyName CSV1 –StorageTiers @($ssd_tier, $hdd_tier) -StorageTierSizes @(50GB,150GB) -ResiliencySettingName Mirror -WriteCacheSize 5GB
PrepCSV CSV1

 

# Creation of a 200 GB non-tiered virtual disk with no cache

New-VirtualDisk -StoragePoolFriendlyName “Demo-FSC1 Pool1” -FriendlyName CSV2 -Size 200GB -ResiliencySettingName Mirror -WriteCacheSize 0
PrepCSV CSV2

 

# Creation of a 50 GB virtual disk on SSD only with 5 GB cache

New-VirtualDisk -StoragePoolFriendlyName “Demo-FSC1 Pool1” -FriendlyName CSV3 –StorageTiers @($ssd_tier) -StorageTierSizes @(50GB) -ResiliencySettingName Mirror -WriteCacheSize 5GB
PrepCSV CSV3

 

EDIT1:

This script broke if the cluster group, Available Storage, was active on another node.  This prevented formatting, which in turn prevented adding the virtual disks as CSVs.  Easy fix: move the Available Storage cluster group to the current machine (a node in the cluster).

 

Forcefully Removing a VM From VMM 2012

I was on a customer site and was asked to help remove a virtual machine from VMM that had failed to V2V correctly from vSphere.  VMM locks the VM in a V2V state and won’t let you repair/undo/anything to the VM.  Not very helpful!

Any attempt to delete the VM was met with the following failure in Jobs:

Error (2604)
Database operation failed.

Recommended Action
Ensure that the SQL Server is running and configured correctly, and try the operation again.

First, I verified that I was targeting the correct VM … don’t want to accidentally delete the source VM from vSphere before a correct V2V:

Get-SCVirtualMachine | where { $_.Name -EQ "Bad-V2V-VM"} | fl name, status

Name   : Bad-V2V-VM
Status : V2VCreationFailed

Next up I took the above code and replaced the FL cmdlet with Remove-SCVirtualMachine, and forced the removal to complete:

Get-SCVirtualMachine | where { $_.Name -EQ "Bad-V2V-VM"} | Remove-SCVirtualMachine –Force

Creating & Adding Lots Of Shared VHDX Files To VMs Using PowerShell

As previously mentioned, I want to run a virtual SOFS in my lab using Storage Spaces.  This is completely unsupported, but it’s fine for my lab.  In the real world, the SOFS with Storage Spaces features physical servers with a JBOD.

I’m lazy, and I don’t want to be creating VHDX files, adding disks by hand, configuring sharing, and repeating for each and every VHDX on each and every VM.

First up: creating the VHDX files.  This snippet will create a 1 GB witness and 8 * 100 GB data disks:

$Folder = “E:Shared VHDXDemo-FSC1”

New-VHD -Path “$FolderDemo-FSC1 Witness Disk.vhdx” -Dynamic -SizeBytes 1GB

for ($DiskNumber = 2; $DiskNumber -lt 9; $DiskNumber++)
{
New-VHD -Path “$FolderDemo-FSC1 Data Disk$DiskNumber.vhdx” -Dynamic -SizeBytes 100GB
}

The next snippet will (a) attach the VHDX files to the default SCSI controller of the VMs, and (b) enable Shared VHDX (Persistent Reservations):

$VMName = “Demo-FS1.demo-internal”

Add-VMHardDiskDrive $VMName -ControllerType SCSI -ControllerNumber 0 -ControllerLocation 0 -Path “E:Shared VHDXDemo-FSC1Demo-FSC1 Witness Disk.vhdx” -SupportPersistentReservations

for ($DiskNumber = 1; $DiskNumber -lt 9; $DiskNumber++)
{
Add-VMHardDiskDrive $VMName -ControllerType SCSI -ControllerNumber 0 -ControllerLocation $DiskNumber -Path “E:Shared VHDXDemo-FSC1Demo-FSC1 Data Disk$DiskNumber.vhdx” -SupportPersistentReservations
}

And there’s the power of PowerShell.  In just a few minutes, I figured this out, and saved myself some boredom, and then sped up my job. With a bit more crafting, I could script a hell of a lot more in this:

  • Creation of VMs
  • Copying and attaching OS disks
  • The above
  • Booting the VMs
  • Use functions to group code and an array of user entered VM names

Note: You might want to consider adding more SCSI controllers to the VMs, especially if you have plenty of vCPUs to spare.  And yes, I did use Dynamic VHDX because this is a lab.

Configuring WS2012 R2 Hyper-V Live Migration Performance Options Using PowerShell

Didier Van Hoye (VM MVP like me) beat me to blogging about configuring the new options for Live Migration in Windows Server 2012 R2 Hyper-V.  He’s doing that a lot lately Smile  There Didier shows you how to configure the performance options for Live Migration in the GUI.  Here’s how you can do it using PowerShell:

Set-VMHost –VirtualMachineMigrationPerformanceOption <Option>

Where <Option> can be:

  • Compression: This is the default option in WS2012 R2 and uses idle CPU capacity (only) to reduce the time to live migrate VMs.
  • SMB: Using SMB 3.0 Direct (if RDMA is available) and Multichannel (if multiple NICs are available)
  • TCPIP: The legacy non-optimized Live Migration option

Example:

Set-VMHost –VirtualMachineMigrationPerformanceOption SMB

And that’s how Ben Armstrong probably scripted his host changes in his TechEd 2013 Live Migration demo (obviously with a lot more logic wrapped around it).

Configuring Jumbo Frames Using PowerShell

Another new version of Windows Server, more features, and another set of PowerShell scripts to write Smile  My host design will be taking advantage of the fact that I have 4 * 10 GbE NICs in each host to play with, and I’ll be implementing my recent converged networks design for SMB 3.0 storage (use the search tool on the top right).

A key in the design is to use the full bandwidth of the NICs.  That means configuring the packet or payload size of each NIC, aka configuring Jumbo Frames.  You can do this by hand, but that’s going to:

  • Get pretty boring after a couple of NICs.
  • Be mistake prone: please send €10 to me every time you get this setting wrong if you disagree with me and continue to do it by hand.

Untitled

You can configure this setting using PowerShell.  It’s not immediately discoverable, but here’s how I discovered it for my NICs.

I ran Get-NetAdapterAdvancedProperty, targeting a 10 GbE NIC.  That returned the advanced settings and their values of the NIC.  These aren’t the traditional attributes.  Each setting has two values:

  • DisplayName: The NIC setting name
  • DisplayValue: The NIC setting value

I knew from the GUI that the DisplayName was Packet Size and that the desired DisplayValue would be 9014.  Now I could configure the setting:

Set-NetAdapterAdvancedProperty <NIC Name> –DisplayName “Packet Size” –DisplayValue “9014”

I could run that command over and over for each NIC.  Consistent Device Naming (CDN) would make this easier, if my servers were new enough to have CDN Smile  I want to configure all my 10 GbE NICs and not configure my still-enabled 1 GbE NIC (used for remote management).  Here’s how I can target the NICs with the setting:

Get-NetAdapter * | Where-Object { $_.TransmitLinkSpeed –EQ “10000000000” } | Set-NetAdapterAdvancedProperty –DisplayName “Packet Size” –DisplayValue “9014”

The first half of that line finds the 10 GbE NICs, thus filtering out the 1 GbE NICs.  Now I can use that line as part of a greater script to configure my hosts.

A Snapshot Is Now A Checkpoint

I’ve previously blogged about the Confusion Over Hyper-V and “Snapshots”.  Well, Microsoft listened to the feedback.  A snapshot is now called … a checkpoint.  The benefits of this name change:

  1. It matches VMM
  2. This should end the confusion with VSS snapshots and SAN snapshots … and hopefully stop people from thinking that a Checkpoint is for backup …. IT IS NOT A BACKUP MECHANISM!  (Yes, there are people who think this).

image

There is a PowerShell cmdlet called Checkpoint-VM to create a checkpoint … the thinking in the Hyper-V team in WS2012 was that you checkpointed a VM.  I can’t say I agreed with that thought process Smile  There are other PowerShell cmdlets too:

image

They still use the term “snapshot”.  I don’t know if that will be changed or aliases will be used (for script backwards compatibility).  I hope something is done to keep things consistent but I doubt there’s much time left for anything to be done in the R2 release.

Carsten Rachfahl (Hyper-V MVP) Interviews Mark Minasi About PowerShell

Carsten Rachfahl (@hypervserver) is at it again; he’s just published a video interview with Mark Minasi (@mminasi), the famed journalist, author, speaker, trainer, consultant and Directory Services MVP.  This time, the topic is the importance of PowerShell to the admin and why they should learn this scripting language.

Videointerview mit Mark Minasi über PowerShell-thumb1

Don’t worry; the page with the video link is auf Deutch but the video is in English.

Hyper-V PowerShell Script Cookbook on TechNet Wiki

If you’ve heard me speak on Windows Server 2012 or Hyper-V recently, then you know that:

  • I did not really do any PowerShell before March of 2012
  • I started then to solve small problems
  • I’m a total convert to the ways of PowerShell because it speeds up work, gives me predictable results (minus my typos), and saves me from those repetitive tasks

Not only will you find PowerShell all over Windows Server 2012 Hyper-V Installation And Configuration Guide, but you’ll find that a new valuable resource has appeared on the TechNet Wiki.  There you will find the “Hyper-V PowerShell Script Cookbook”.

The goal of this site is to shared PowerShell snippets and scripts.  Right now, the categories include:

  • Virtual Machine
  • Virtual Hard Disk
  • Network Virtualization
  • Virtual Switch
  • Additional scripts

As all good scripters know, you first start by searching, then copying/pasting, and then modifying to get the results you want.  Why not start here … and then contribute any new stuff you create!?!?!