Archive

Archive for the ‘NetApp’ Category

SRM for free with PowerCLI & DataONTAP– Part 2: iSCSI

September 14th, 2011 2 comments

My updated previous NFS post talked about implementing part of the functionality of SRM in Powershell using PowerCLI and NetApp’s DataONTAP for NFS datastores.

This post is an update to my previous iSCSI post in which I had only looked at the VMware side of the automation and so it’s time for an update to include the important part of handling the underlying storage. I’m going to use NetApp storage as an example but any storage vendor that exposes their API to Powershell can be used if you can find the relevant commands.

You will obviously need both PowerCLI and Netapp’s DataONTAP installed. See my previous post: Pimping your Powershell Profile for getting everything installed.

For the storage automation, all you really have to do is connect to the filer and then quiesce and break the storage mirror so it is writeable at the BR site. After you’ve connected this is a single line:

Get-NaSnapmirror "FilerName" | Invoke-NaSnapmirrorQuiesce | Invoke-NaSnapmirrorBreak -Confirm:$false

Read more…

SRM for free with PowerCLI & DataONTAP– Part 1: NFS

August 16th, 2011 1 comment

I’ve blogged before on how you can use PowerCLI to replicate some of the functionality of VMware’s SRM to easily recover VMs in a business recovery site with replicated storage.

In my previous post I had only looked at the VMware side of the automation and so it’s time for an update to include the important part of handling the underlying storage. I’m going to use NetApp storage as an example but any storage vendor that exposes their API to Powershell can be used if you can find the relevant commands.

This is where the awesomeness of Powershell really comes into its own when you can combine automation for both VMware and NetApp in a single script.

You will obviously need both PowerCLI and Netapp’s DataONTAP installed. See my previous post: Pimping your Powershell Profile for getting everything installed.

Read more…

NetApp PowerShell Toolkit, DataONTAP 1.5 released

August 4th, 2011 No comments

NetApp has updated it’s Powershell Toolkit which it calls DataONTAP to version 1.5 (I think PowerONTAP would be a much better name!).

You will need a Netapp NOW account which is available to customers and partners to download the toolkit.
http://communities.netapp.com/community/interfaces_and_tools/data_ontap_powershell_toolkit

There are 27 new cmdlets taking the total up to a massive 528 cmdlets with nearly all possible API’s now covered.

Read more…

NetApp DataONTAP 1.3 released

February 8th, 2011 No comments

NetApp’s Powershell Toolkit has been updated to 1.3.
http://communities.netapp.com/community/interfaces_and_tools/data_ontap_powershell_toolkit/data_ontap_powershell_toolkit_downloads?view=overview

Highlights are:

  • Create a PSDrive and access the ONTAP file system as if it was a local disk
  • Using a Credential Cache
  • Being able to invoke SSH directly from within DataOntap so you can run any CLI command as the API doesn’t cover everything
  • More -WhatIf parameter usage

You can get more information from Making The Most Of Data ONTAP PowerShell Toolkit 1.3

Microsoft has created a fantastic administration environment with Powershell, the more companies that create PowerShell modules the better so good work NetApp, looking forward to some more!

Categories: NetApp, Powershell Tags: ,

Disk timeout settings in registry for VMs using PowerCLI

September 1st, 2010 3 comments

One of NetApp’s best practices is to increase the disk timeout settings for VMs to 190 seconds so VMs don’t blue screen if they temporary lose connectivity to their disks say during a cluster failover.

This is done by amending the Disk Timeout registry value:
HKLM\SYSTEM\CurrentControlSet\Services\Disk\TimeoutValue to DWord 190.

I’m sure you’d love to go through all your VMs and load regedit manually so why not grab a list of VMs using PowerCLI and set the registry value.

The VMs will obviously need to be powered on and you will need permissions to be able to write to the registry.

The procedure is a 2 step process:

The first is to get all the VMs you want to change.
You can use any Get-VM statement you want:

All VMs in a particular Resource Pool

$VMs = Get-VM -Location (Get-ResourcePool "Resource_Pool_Prod") | Where { $_.PowerState -eq "PoweredOn" }

or

$VMs = Get-ResourcePool "Resource_Pool_Prod" | Get-VM | Where { $_.PowerState -eq "PoweredOn" }

All VMs in a particular Cluster

$VMs = Get-Cluster "LON_PROD1" | Get-VM | Where { $_.PowerState -eq "PoweredOn" }

All VM names starting with WEBSERVER

$VMs = Get-VM "WEBSERVER*" | Where { $_.PowerState -eq "PoweredOn" }

The second stage is to work some registry magic for the VMs you have.

You can then read the current registry value:

ForEach ($VM in $VMs) {
	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $VM.Guest.Hostname)
	Write-Host "Registry Value for: "$VM.Guest.Hostname ": " $reg.OpenSubKey("SYSTEM\CurrentControlSet\Services\Disk\").GetValue("TimeoutValue")
}

To write the registry value:

ForEach ($VM in $VMs) {
	Write-Host "Setting Registry Value for: "$VM.Guest.Hostname
	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $VM.Guest.Hostname)
	$regKey= $reg.OpenSubKey("SYSTEM\CurrentControlSet\Services\Disk",$true)
	$regkey.SetValue('TimeoutValue',200,'DWord')
}

Or you can combine a read, set and verify.

ForEach ($VM in $VMs) {
	$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $VM.Guest.Hostname)
	Write-Host "Registry Value Before: "$VM.Guest.HostName "-" $reg.OpenSubKey("SYSTEM\CurrentControlSet\Services\Disk\").GetValue("TimeoutValue")

	$regKey= $reg.OpenSubKey("SYSTEM\CurrentControlSet\Services\Disk",$true)
	$regkey.SetValue('TimeoutValue',190,'DWord')

	Write-Host "Registry Value After:  "$VM.Guest.HostName "-" $reg.OpenSubKey("SYSTEM\CurrentControlSet\Services\Disk\").GetValue("TimeoutValue")
}

or be bold and set it in a one liner:

Get-VM "WEBSERVER*" | Where { $_.PowerState -eq "PoweredOn" } | %{[Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $_.Guest.Hostname).OpenSubKey("SYSTEM\CurrentControlSet\Services\Disk",$true).SetValue('TimeoutValue',190,'DWord')}

Powershell…you gotta love it!