Archive

Archive for August, 2010

vSphere powercli multipath policy script examples – updated

August 31, 2010 5 comments

#Shows the multipath policy for all LUN’s connected to all hosts in Cluster Primary
Get-Cluster Primary | Get-VMHost | Get-ScsiLun -LunType disk

#Shows the multipath policy for all LUN’s connected to host host4
Get-VMHost host4 | Get-ScsiLun -LunType disk

#Sets the multipath policy for all EMC LUN’s (naa.6006*) connected to all hosts in Cluster RV00 to roundrobin
Get-Cluster RV00 | Get-VMHost | Get-ScsiLun -CanonicalName “naa.6006*” | Set-ScsiLun -MultipathPolicy “roundrobin”

#Sets the multipath policy for all EMC LUN’s connected to host host4
Get-VMHost host4 | Get-ScsiLun -CanonicalName “naa.6006*” | Set-ScsiLun -MultipathPolicy “roundrobin”

# Output the CanonicalName for all the devices on Cluster Primary that are EMC type (naa.6006*)
Get-Cluster Primary | Get-VMHost | Get-ScsiLun -CanonicalName “naa.6006*” | fl -show CanonicalName | out-file c:\shared\naa-id.txt

# This is a script I have developed to connect to a Virtual Center server and set the mulitpathing policy for all datastores on all hosts in a Cluster to Round Robin. You will need to install PowerCLI and vSphereCLI (ebsure you check the path to esxcli in the script matches your installation directory), it will prompt you for the vCenter Server IP, credentials, a Cluster name and the root password for the ESX hosts.

#Variables
#ESX host username
$Username = “root”
#vSphere CLI esxcli.exe path
$esxcli = “C:\Program Files\VMware\VMware vSphere CLI\bin\esxcli.exe”
#Prompt for vCenter Server
$viServer = Read-Host “Enter vCenter server Name: ”
Connect-VIServer $viServer
#Prompt for vCenter Server Cluster
$viCluster = Read-Host “Enter vCenter Cluster: ”

#list of ESX and ESXi host to perform operation against
$vihosts = Get-Cluster $viCluster | Get-vmhost | sort Name | % {$_.Name}

#prompt user for password
$passwordInput = Read-Host -AsSecureString:$true “Please enter your common password for ESX hosts”

#convert secure password to normal string
$Ptr = [System.Runtime.InteropServices.Marshal]::SecureStringToCoTaskMemUnicode($passwordInput)
$Password = [System.Runtime.InteropServices.Marshal]::PtrToStringUni($Ptr)
[System.Runtime.InteropServices.Marshal]::ZeroFreeCoTaskMemUnicode($Ptr)

#loop through array of hosts and set default SATP policy to RoundRobin
for($i = 0; $i -le $vihosts.length -1; $i++) {
write-Host Executing set default PSP for ALUA_CX to RR on $vihosts[$i]
#insert esxcli parameters at the very end of the statement below
& $esxcli –server $vihosts[$i] –username $Username –password $Password nmp satp setdefaultpsp –satp VMW_SATP_ALUA_CX –psp VMW_PSP_RR
}

#loop through array of hosts and set PSP policy to RoundRobin
foreach ($viHost in $vihosts)
{
write-Host Executing set policy RR per device on $viHost
$lunList = get-vmhost $viHost | get-scsilun -CanonicalName “*” | % {$_.CanonicalName}
foreach ($lun in $lunList)
{
write-Host Executing set policy RR per device on $lun
#could not find a way to store the params in a variable you must
#insert esxcli parameters at the very end of the statement below
#write-host “$esxcli –server $viHost –username $Username –password $Password nmp device setpolicy –psp VMW_PSP_RR –device $lun”
& $esxcli –server $viHost –username $Username –password $Password nmp device setpolicy –psp VMW_PSP_RR –device $lun
}
}

#loop through array of hosts and enable the use of non-optimised paths
foreach ($viHost in $vihosts){
write-Host Executing use unoptimized paths on $viHost
foreach ($lun in $lunList){
#could not find a way to store the params in a variable you must
#insert esxcli parameters at the very end of the statement below
#write-host “$esxcli –server $viHost –username $Username –password $Password nmp roundrobin setconfig –useANO 1 –device $lun”
& $esxcli –server $viHost –username $Username –password $Password nmp roundrobin setconfig –useANO 1 –device $lun
}
}

Categories: EMC, Powershell, Scripting, VMware

vSphere plug-in unable to connect to the remote server

August 31, 2010 Leave a comment

Today I found the following issue at a customers site, none of their plug-ins for vCenter including the hardware status were working.

I checked and the VMware webservices service were set to automatic but wasn’t not currently running. I started the service and this fixed the issue. I check the event log and it seems the service was failing to start. The reason for this is that this service talks to the SQL instance but the SQL instance (which was installed locally, SQL express) was taking longer to start than the webservices service.

There are two options, either set the service to have a delayed start, requires Windows 2008 or define the SQL instance as a dependant service for the vctomcat service in the registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\vctomcat”
inserting the SQL instance name, i.e. “MSSQL$SQLEXP_VIM” in the list

Categories: VMware

Teched 2010 roundup

August 29, 2010 Leave a comment

Well Teched has finished for another year, this years Teched ended on a high with an inspirational speech during the Locknote and the unveilling of @themolk as @thatguyatteched. I found this years event great for networking, met lot of new people and joined the autechheads. This years hands on labs were much better than previous years and I got a from them. The swag was limited this year but some of the autechehads including @invalidurl scored the new Xbox 360’s. This week we have VMworld in San Fransico so there will be a lot of information coming out of that event including I suspect Flare 30 for EMC CX.

Categories: EMC, Microsoft, VMware

Teched day two

August 25, 2010 Leave a comment

Long day, lots of sessions, some sessions were good, some a little dissappointing. Got a bit annonyed with the Exchange Virtualisation Best Practices as the speaker Scott Schnoll who refused to mention any hypervisor other than hyper-v, the large white elephant in the corner just got bigger and bigger throughout the session. No support for Live Migratio (vmotion) for VM’s participanting in a DAG, but then he claims no support for HA, mmm right….

Also Exchange Storage and JBOD,  could Microsoft go on and on more about something people simply wont implement. Sure I understand EXCH2010 is better on disks and DAGs (not the sheep ones), mean you have protection at the application layer but I don’t know a single Server vendor who ships a product that supports JBOD!!

So the real answer is no need to separate logs and db’s, use RAID 5 on tier 2 storage (SATA) and implement DAG’s.

Categories: Exchange, Microsoft

AuTechHeads

August 24, 2010 Leave a comment

Went to the AuTechHeads party tonight, met lots of great people and had a good time, follow #autechheads on twitter.

Categories: Microsoft

Auteched 2010

August 24, 2010 Leave a comment

Just arrived at Teched 2010, passed my Exchange exam so I’m now an Exchange Messaging Adminstrator for Exch2010. Met with a Microsoft Platform Ready for Partners employee, sounds like a good idea. On the look out for a good coffee as normally the teched ones are pretty average!

Categories: Exchange, Microsoft

Bledisloe in Brisbane 2011

August 19, 2010 Leave a comment

It was confirmed today that Brisbane will be the host for the only Bledisloe on Australian soil next year. The last time it was held here was 2008, it’s great news as it will be the last chance to see the AB’s before the world cup. Now I just have to get tickets!

Categories: All Blacks