Advertisement Header

Tuesday 23 November 2010

How to use ADPlus to troubleshoot "hangs" and "crashes"

ADPlus is a tool from Microsoft Product Support Services (PSS) that can troubleshoot any process or application that stops responding (hangs) or fails (crashes). Frequently, you can use ADPlus (ADPlus.vbs) as a replacement tool for the Microsoft Internet Information Server (IIS) Exception Monitor (6.1/7.1) and User Mode Process Dump. These are two separate tools that PSS frequently uses to isolate what causes a process to stop responding (hang) or quit unexpectedly (crash) in a Microsoft Windows DNA environment.

Click Here to Download ADPlus

Wednesday 3 November 2010

Send-SMTPmail Using Powercli

Below function should be include in the script:
function Send-SMTPmail($to, $from, $subject, $smtpserver, $body, $attachment) {
$mailer = new-object Net.Mail.SMTPclient($smtpserver)
$msg = new-object Net.Mail.MailMessage($from,$to,$subject,$body)
$msg.IsBodyHTML = $true
$attachment = new-object Net.Mail.Attachment($attachment)
$msg.attachments.add($attachment)
$mailer.send($msg)
}

Command which need to use in the script after function declaration
send-SMTPmail $EmailTo $EmailFrom “$VISRV vCheck Report” $SMTPSRV -body “$VISRV vCheck Report” -attachment “$Filename”

Tuesday 17 August 2010

Howto: Rename a VM

There are a couple of ways to rename a Virtual Machine, but there are two in my opinion that stand out:
  1. Shutdown the VM
  2. Rename the VM in VirtualCenter
  3. Migrate the VM and move it to another Datastore
  4. done!
And from the service console:
  1. vmware-cmd -s unregister /vmfs/volumes/datastore/vm/vmold.vmx
  2. mv /vmfs/volumes/datastore/vm-old /vmfs/volumes/datastore/vm-new
  3. cd /vmfs/volumes/datastore/vm-new
  4. vmkfstools -E vm-old.vmdk vm-new.vmdk
  5. find . -name ‘*.vmx*’ -print -exec sed -e ‘s/vm-old/vm-new/g’ {} \;
  6. mv vm-old.vmx vm-new.vmx
    for every file that hasn’t been renamed (.vmsd etc.)
  7. vmware-cmd -s register /vmfs/volumes/datastore/vm-new/vm-new.vmx
  8. done!

Monday 16 August 2010

VMware Workstation Unrecoverable error VMX

If we have a issue wot Resume windows which is in suspended mode and if we get below error:


Then we need to delete respective vmss file from the folder where the VM configuration files are located.

Thursday 12 August 2010

Run Commands Remotely in Windows

rsh and rexec commands (inbuilt) and we can use PsExec.exe

RSH:
---
Runs commands on remote hosts running the RSH service.

RSH host [-l username] [-n] command

host Specifies the remote host on which to run command.
-l username Specifies the user name to use on the remote host. If
omitted, the logged on user name is used.
-n Redirects the input of RSH to NULL.
command Specifies the command to run.

Rexex:
------
Runs commands on remote hosts running the REXEC service. Rexec
authenticates the user name on the remote host before executing the
specified command.

REXEC host [-l username] [-n] command

host Specifies the remote host on which to run command.
-l username Specifies the user name on the remote host.
-n Redirects the input of REXEC to NULL.
command Specifies the command to run.

Wednesday 28 July 2010

How to Run Multiple commands Remotely Using Script in Linux/Unix

#!/bin/bash
# Linux/UNIX box with ssh key based login
SERVERS="Server1 server2 server3"
# SSH User name
USR="Admin"

# Email
SUBJECT="Server user login report"
EMAIL="sravan03ie29@hotmail.com"
EMAILMESSAGE="/tmp/emailmessage.txt"

# create new file
>$EMAILMESSAGE

# connect each host and pull up user listing
for host in $SERVERS
do
echo "--------------------------------" >>$EMAILMESSAGE
echo "* HOST: $host " >>$EMAILMESSAGE
echo "--------------------------------" >>$EMAILMESSAGE
sudo ssh $USR@$host " hostname; df -h" >> $EMAILMESSAGE
done

# send an email using /bin/mail
/bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE

Tuesday 6 July 2010

Loop Processing in Powershell

For Loop:

for ($i=1; $i -le 5; $i++)
{Write-Host $i}

Output:
1
2
3
4
5
------------------------------
$i=1
for (; $i -le 5; $i++)
{Write-Host $i}
------------------------------
$ints = @( 1, 2, 3, 4, 5)

for ($i=0; $i -le $ints.Length – 1; $i++)
{Write-Host $ints[$i]}
------------------------------

Foreach:

$ints = @(1, 2, 3, 4, 5)

foreach ($i in $ints)
{Write-Host $i}

Output:
1
2
3
4
5
-----------------------------
for($i=1; $i -le 10; $i++)
{
Write-Host $i
break
}
-----------------------------
$i=0
$varB = (10,20,30,40)
foreach ($var in $varB)
{
$i++
if ($var -eq 30)
{
break
}
}
Write-Host “30 was found in array position $i”
------------------------------

Tuesday 29 June 2010

Running a PowerCLI Scheduled task

There are two ways of doing this really:

1. Add a line to a start of each of your scripts to make sure it loads the PowerCLI snapin, without which PowerShell will not recognise any of the PowerCLI cmdlets.

Add the following line to the top of each script you will be running as a scheduled task:

add-pssnapin VMware.VimAutomation.Core

Then in the run box on your scheduled task you can call your script with the following command:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe “& ‘C:\Scripts\MyScript.ps1′”

But remember when you are troubleshooting this script or amending it you will most likely get an error as your script editor will automatically add the VMware snapin.

2. This method is the one I use as its easier than remembering to put the line at the top of each file and then commenting it out when you want to edit it etc, this method runs the PowerCLI Console file before it runs your script.

A PowerShell Console file is a xml like file containing information on what snapins to load when PowerShell is started.

This will enable the snapin for you and there is nothing to ad to the scripts.

The run command then looks like this:

C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" "& 'C:\Host-Inventory-Status.ps1'"

You can test both of these methods by running them from a cmd prompt before using it to ensure they work properly.

Monday 28 June 2010

How do I put Count Line numbers on an output

Command:
(get-vmhost).count

Output will be like this:
51

(or)

Command : get-vmhost | measure-object

Output will be:
Count : 51
Average :
Sum :
Maximum :
Minimum :
Property :

Thursday 24 June 2010

To manage more than one VirtualCenter server & ESX at a time

If you want to connect to more than one virtual center at the same time, here the starting code :

$vcs = @()
$vcs += connect-viserver "vc 1"
$vcs += connect-viserver "vc 2"
# You could add many as you need...

# Command example : Snapshot all VMs across all VirtualCenter servers.
get-vm -server $vcs | new-snapshot

Note:-
Be careful, the command GET-VM $VCS will not return the same values than GET-VM.
If you use GET-VM, you will receive the VM List only for the Virtual Center that you connect last. If you want the get all the VM of your different virtual centers, you absolutely need to add the parameter -server $vcs to you command. In a general way, don’t forget to add -server $vcs to every command than you use with the VI Toolkit.

Monday 14 June 2010

A few notes about the new VCAP certifications

Here's a colleciton of lots of things I've learned about the new VMware Certified Advanced Professional certifications for vSphere 4:

* The DataCenter Administration exam will be 100% live labs
* Your score for the DataCenter Administration exam will not be given immediately on completion of the exam, just like the Enterprise Administration exam for VI3 today
* The DataCenter Administration exam will cost $400, the price for the DataCenter Design exam has not yet been set
* The DataCenter Design exam will be a mixture of multiple-choice questions, and a design exercise, as it is today for VI3
* The testing centres for the DataCenter Administration exam will be expanded to a significantly larger pool than it is today
* The new exams will be scheduled directly with Pearson Vue, only the VCDX design defence will need arranging directly with VMware
* The blueprint documents for the new exams are still in development and will be released soon
* The new exams will not have compulsory training course requirements
* The advanced-level Performance, Troubleshooting, and Security courses are recommended as preparation for the DataCenter Administration exam, the exam content is centred around those 3 key areas
* The vSphere: Design Workshop will be excellent preparation for the DataCenter Design exam, the workshop content covers all of the objectives in the exam
* The beta periods for both exams will begin shortly, and will be invitation-only
* VMware partner requirements will not include VCAP certifications at this time

Advanced-level vSphere certifications


VMware have now officially announced the three advanced-level certifications for vSphere 4:

1. VMware Certified Advanced Professional on vSphere 4 - Datacenter Administration (VCAP-DCA)
2. VMware Certified Advanced Professional on vSphere 4 - Datacenter Design (VCAP-DCD)
3. VMware Certified Design Expert on vSphere 4 - Datacenter Design (VCDX4-DCD)

PowerCLI: One-Liner to get VMs, Clusters, ESX Hosts and Datastores

Get-VM | Select Name, @{N="Cluster";E={Get-Cluster -VM $_}},
@{N="ESX Host";E={Get-VMHost -VM $_}},
@{N="Datastore";E={Get-Datastore -VM $_}} |
Export-Csv -NoTypeInformation C:\Scripts\VM_CLuster_Host_Datastore.csv

Wednesday 12 May 2010

VIM Report

param( [string] $VIServer )

if ($VIServer -eq ""){
Write-Host
Write-Host "Please specify a VI Server name eg...."
Write-Host " powershell.exe Report.ps1 MYVISERVER"
Write-Host
Write-Host
exit
}

function PreReq
{
if ((Test-Path REGISTRY::HKEY_CLASSES_ROOT\Word.Application) -eq $False){
Write-Host "This script directly outputs to Microsoft Word, please install Microsoft Word"
exit
}
Else
{
Write-Host "Microsoft Word Detected"
}
if ((Test-Path REGISTRY::HKEY_CLASSES_ROOT\OWC11.ChartSpace.11) -eq $False){
Write-Host "This script requires Office Web Components to run correctly, please install these from the following website: http://www.microsoft.com/downloads/details.aspx?FamilyId=7287252C-402E-4F72-97A5-E0FD290D4B76&displaylang=en"
exit
}
Else
{
Write-Host "Office Web Components Detected"
}
$wordrunning = (Get-Process 'WinWord' -ea SilentlyContinue)
if ( $wordrunning -eq ""){
Write-Host "Please close all instances of Microsoft Word before running this report."
exit
}
else
{
}
}

function InsertTitle ($title)
{
# Insert Document Title Information
$objSelection = $msWord.Selection
$objSelection.Style = "Heading 1"
$objSelection.TypeText($Title)
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
$msword.Selection.EndKey(6) > Null
}

function InsertText ($text)
{
# Insert Document text
$objSelection = $msWord.Selection
$objSelection.Style = "Normal"
$objSelection.TypeText($text)
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
$msword.Selection.EndKey(6) > Null
}

function InsertChart ($Caption, $Stat, $NumToReturn, $Contents)
{
Write-Host "Creating $Caption bar chart...Please Wait"
$categories = @()
$values = @()
$chart = new-object -com OWC11.ChartSpace.11
$chart.Clear()
$c = $chart.charts.Add(0)
# 3D chart type, change the following .Type = 52
$c.Type = 4
$c.HasTitle = "True"
$series = ([array] $chart.charts)[0].SeriesCollection.Add(0)

if ($stat -eq ""){
$contents | foreach-object {
$categories += $_.Name
$values += $_.Value * 1
}
$series.Caption = $Caption
}
else
{
$i = 1
$j = $contents.Length
$myCol = @()
ForEach ($content in $contents)
{
Write-Progress -Activity "Processing Graph Information" -Status "$content ($i of $j)" -PercentComplete (100*$i/$j)
$myObj = "" | Select-Object Name, Value
$myObj.Name = $content.Name
$messtat = Get-Stat -Entity $content -Start ((Get-Date).AddHours(-24)) -Finish (Get-Date) -Stat $stat
$myObj.Value = ($messtat| Measure-Object -Property Value -Average).Average
$myCol += $myObj
$i++
}
$myCol | Sort-Object Value -Descending | Select-Object -First $numtoreturn | foreach-object {
$categories += $_.Name
$values += $_.Value * 1
}
$series.Caption = "$Caption (last 24hrs)"
}
$series.SetData(1, -1, $categories)
$series.SetData(2, -1, $values)
$filename = (resolve-path .).Path + "\Chart.jpg"
$chart.ExportPicture($filename, "jpg", 900, 600)

$objSelection = $msWord.Selection
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
$msWord.Application.Selection.InlineShapes.AddPicture($filename) > Null
Remove-Item $filename
$msword.Selection.EndKey(6) > Null
}

function InsertPie ($Caption, $Contents, $cats)
{
Write-Host "Creating $Caption pie chart...Please Wait"
$categories = @()
$values = @()
$chart = new-object -com OWC11.ChartSpace.11
$chart.Clear()
$c = $chart.charts.Add(0)
# Non 3D pie chart, change the following .Type = 18
$c.Type = 58
$c.HasTitle = "True"
$c.HasLegend = "True"
$series = ([array] $chart.charts)[0].SeriesCollection.Add(0)
$dl = $series.DataLabelsCollection.Add()
$dl.HasValue = "True"

$Contents | foreach-object {
$categories = $cats[0], $cats[1]
$values = [math]::round(($contents[0]), 0), [math]::round(($contents[1]), 0)
}

$series.Caption = $Caption
$series.SetData(1, -1, $categories)
$series.SetData(2, -1, $values)
$filename = (resolve-path .).Path + "\PIE.jpg"
$chart.ExportPicture($filename, "jpg", 900, 600)

$objSelection = $msWord.Selection
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
$msWord.Application.Selection.InlineShapes.AddPicture($filename) > Null
$msword.Selection.EndKey(6) > Null
Remove-Item $filename
}

function TableOutput ($Heading, $columnHeaders, $columnProperties, $contents)
{
Write-Host "Creating $Heading Table...Please Wait"
# Number of columns
$columnCount = $columnHeaders.Count

# Insert Table Heading
$Title = $Heading
InsertTitle $title

# Create a new table
$docTable = $wordDoc.Tables.Add($wordDoc.Application.Selection.Range,$contents.Count,$columnCount)

# Insert the column headers into the table
for ($col = 0; $col -lt $columnCount; $col++) {
$cell = $docTable.Cell(1,$col+1).Range
$cell.Font.Name="Arial"
$cell.Font.Bold=$true
$cell.InsertAfter($columnHeaders[$col])
}
$doctable.Rows.Add() > Null

# Load the data into the table
$i = 1
$j = $contents.Count
for($row = 2; $row -lt ($contents.Count + 2); $row++){
if($row -gt 2){
}
for ($col = 1; $col -le $columnCount; $col++){
Write-Progress -Activity "Processing Table Information" -Status "Adding Row entry $i of $j" -PercentComplete (100*$i/$j)
$cell = $docTable.Cell($row,$col).Range
$cell.Font.Name="Arial"
$cell.Font.Size="10"
$cell.Font.Bold=$FALSE
$cell.Text = $contents[$row-2].($columnProperties[$col-1])
}
$i++
}

# Table style
$doctable.Style = "Table List 4"
$docTable.Columns.AutoFit()
$objSelection = $msWord.Selection
$msword.Selection.EndKey(6) > Null
$objSelection.TypeParagraph()
$msword.Selection.EndKey(6) > Null

}
$date = Get-date
Prereq

# Connect to the VI Server
Write-Host "Connecting to VI Server"
Connect-VIServer $VIServer

# Get Word Ready for Input
# Launch instance of Microsoft Word
Write-Host "Creating New Word Document"
$msWord = New-Object -Com Word.Application
# Create new document
$wordDoc = $msWord.Documents.Add()
# Make word visible (optional)
$msWord.Visible = $false
# Activate the new document
$wordDoc.Activate()

# Insert Document Title

$Title = "VMWare Report produced for $VIServer"
InsertTitle $title

$Title = "Created on " + $date
InsertTitle $title

#Setting common used commands to speed things up
Write-Host "Setting Variables...Please wait"
$VMs = Get-VM
$VMHs = Get-VMHost
$Ds = Get-Datastore
$rp = Get-resourcepool
$clu = Get-Cluster

# Send VM Host Information to Document
$myCol = @()
ForEach ($vmh in $vmhs)
{
$hosts = Get-VMHost $vmh.Name | %{Get-View $_.ID}
$esx = "" | select-Object Name, Version, NumCpuPackages, NumCpuCores, Hz, Memory
$esx.Name = $hosts.Name
$esx.Version = $hosts.Summary.Config.Product.FullName
$esx.NumCpuPackages = $hosts.Hardware.CpuInfo.NumCpuPackages
$esx.NumCpuCores = $hosts.Hardware.CpuInfo.NumCpuCores
$esx.Hz = [math]::round(($hosts.Hardware.CpuInfo.Hz)/10000, 0)
$esx.Memory = [math]::round(($hosts.Hardware.MemorySize)/1024, 0)
$myCol += $esx
}
$contents = $myCol
$columnHeaders = @('Name', 'Version', 'CPU', 'Cores', 'Hz', 'Memory' )
$columnproperties = @('Name', 'Version', 'NumCpuPackages', 'NumCpuCores', 'Hz', 'Memory')
$Heading = "Host Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

$totalhosts = $VMhs.Length
$Text = "Total Number of Hosts: $totalhosts"
InsertText $Text

#Insert VM Host CPU Graph
$contents = $VMHs
$Stat = "cpu.usage.average"
$NumToReturn = 5
$Caption = "Top " + $NumToReturn + " Hosts CPU Usage %Average"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
InsertChart $Caption $Stat $NumToReturn $contents
}

#Insert VM Host MEM Graph
$contents = $VMHs
$Stat = "mem.usage.average"
$NumToReturn = 5
$Caption = "Top " + $NumToReturn + " Hosts MEM Usage %Average"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
InsertChart $Caption $Stat $NumToReturn $contents
}

# Send VM Information to the document
$contents = @($VMs | Sort-Object Name )
$columnHeaders = @('Name','CPUs','MEM','Power','Description')
$columnProperties = @('Name','NumCPU','MemoryMB','PowerState','Description')
$Heading = "VM Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

$totalhosts = $VMs.Length
$Text = "Total Number of Virtual Machines: $totalhosts"
InsertText $Text

#Insert VM CPU Graph
$contents = $VMs
$Stat = "cpu.usage.average"
$NumToReturn = 5
$Caption = "Top " + $NumToReturn + " Virtual Machines CPU Usage %Average"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
InsertChart $Caption $Stat $NumToReturn $contents
}

#Insert VM MEM Graph
$contents = $VMs
$Stat = "mem.usage.average"
$NumToReturn = 5
$Caption = "Top " + $NumToReturn + " Virtual Machines MEM Usage %Average"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
InsertChart $Caption $Stat $NumToReturn $contents
}

# Send VM Tools Information to Document
$contents = @($VMs | % { get-view $_.ID } | select Name, @{ Name="ToolsVersion"; Expression={$_.config.tools.toolsVersion}} | Sort-Object Name)
$columnHeaders = @('Name','VM Tools Version')
$columnproperties = @('Name', 'ToolsVersion')
$Heading = "VMWare Tools Version"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

# Datastore report
$contents = @($Ds | Sort-Object Name)
$columnHeaders = @('Name','Storage Type','Total Size','Free Space')
$columnProperties = @('Name','Type','CapacityMB','FreeSpaceMB')
$Heading = "Datastore Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

#Insert Datastore Pie Charts
foreach ($contents in $Ds)
{
$UsedSpace = $contents.CapacityMB - $contents.FreespaceMB
$categories = @('Free Space', 'Used Space')
$newcontents = @($contents.FreespaceMB, $usedSpace)
$Caption = $contents.Name + " Space Allocation"
if ($contents -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
InsertPie $Caption $newcontents $categories
}

}

# Send Cluster Information to Document
$contents = @($clu | Sort-Object Name)
$columnHeaders = @('Name','HA Enabled','HA Failover Level','DRS Enabled','DRS Mode')
$columnProperties = @('Name', 'HAEnabled', 'HAFailoverLevel', 'DRSEnabled', 'DrsMode')
$Heading = "Cluster Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

# Send ResourcePool Information to Document
$contents = @($rp | select-object Name, MemLimitMB, CpuLimitMhz, NumCPUShares, NumMemShares | Sort-Object Name)
$columnHeaders = @('Name', 'Memory Limit MB', 'CPU Limit Mhz', 'CPU Shares', 'MEM Shares')
$columnProperties = @('Name', 'MemLimitMB', 'CpuLimitMhz', 'NumCPUShares', 'NumMemShares')
$Heading = "Resource Pool Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

# Send Snapshot Information to Document
$contents = @($VMs | Get-Snapshot | select-object VM, Name, Description)
$columnHeaders = @('VM', 'Name', 'Description')
$columnProperties = @('VM', 'Name', 'Description')
$Heading = "Snapshot Information"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

# Send Snapshot's over 1 month old to Document
$contents = @($VMs | Get-Snapshot | where { $_.Created -lt (get-date).addmonths(-1)} | select-object VM, Name, Description, Created)
$columnHeaders = @('VM', 'Name', 'Description', 'Created')
$columnProperties = @('VM', 'Name', 'Description', 'Created')
$Heading = "Snapshot's over 1 Month old"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
Tableoutput $Heading $columnHeaders $columnProperties $contents
}

#Insert Snapshot Graph
$myCol = @()
ForEach ($vm in $vms)
{
$snapshots = Get-Snapshot -VM $vm
$myObj = "" | Select-Object Name, Value
$myObj.Name = $vm.name
$myObj.Value = ($snapshots | measure-object).count
$myCol += $myObj
}
$contents = @($myCol | Where-Object{$_.Value -gt 0} | Sort-Object Name)
$Stat = ""
$NumToReturn = ""
$Caption = "Number of snapshots per VM"
if ($contents[0] -eq $null){
Write-Host "No entries for $Heading found"
}
else
{
InsertChart $Caption $Stat $NumToReturn $contents
}

Write-Host "------------------------------"
Write-Host "Start Date: $date"
$enddate = get-date
Write-Host "End Date: $enddate"

# Show the finished Report
$msword.Selection.HomeKey(6) > Null
$msWord.Visible = $true

# Save the document to disk and close it
$filename = 'C:\VMReport.doc'
$wordDoc.SaveAs([ref]$filename)

#Close the document if you are using as a scheduled task
#$wordDoc.Close()

# Exit our instance of word
#$msWord.Application.Quit()

#Email options for automated emailed report
#$smtpServer = “localhost”
#
#$msg = new-object Net.Mail.MailMessage
#$att = new-object Net.Mail.Attachment($filename)
#$smtp = new-object Net.Mail.SmtpClient($smtpServer)
#
#$msg.From = “somebody@yourdomain.com”
#$msg.To.Add(”somebody@theirdomain.com”)
#$msg.Subject = “VMware Report”
#$msg.Body = “Please find attached the automated VMware report”
#$msg.Attachments.Add($att)
#
#$smtp.Send($msg)

#Delete file if no longer needed once sent via email
#Remove-Item $filename
Disconnect-VIServer -Confirm:$False

Wednesday 28 April 2010

Monday 26 April 2010

VCDX Defense

The last part of the VCDX certification is the defense. In short: you will need to write a design, fill out the application and defend your design during a two to three hour session.

Although I can describe it in 30 words it is not as simple as it may sound. First of all your design needs to meet specific requirements. I can’t go in to the details unfortunately but when you receive an invitation you will receive all the prerequisites. Like me, most of you done numerous designs, but keep in mind it needs to be in English and so will your defense need to be. This is an extra barrier for many of the non- native speakers; I know it was for me.

The defense part:
75 minutes – executive overview and an in-depth design defense
30 minutes – design workshop
15 minutes – problem analysis

For the first 15 minutes, the executive overview, you can use a couple of slides. Like I said it’s an executive overview and its only 15 minutes so don’t go into the technical details, there’s no need for that share your experience and maybe tell about political issues for instance. These 15 minutes gave me the opportunity to get rid of my nerves.

The in depth design defense is self-explanatory I think. Just be prepared to get questions on every single aspect of your design, know it inside out and not only “what” and “how”, but especially “why”.

Next two are role-play based. The panel is the customer and you are the architect. By asking questions, white boarding, discussions you will need to solve an issue or come to a specific solution for the customer. This is something you can not really prepare. Although you may think you will have more than enough time, you will not have time enough. Time flies when the pressure is on. Keep in mind that it’s not the end result that counts for these scenarios, it’s your thought process!

I’ve read comments on the written exams; some thought they were too easy. I can promise you this will not be easy this is not a test you can study for and pass if you crammed all the details. You will need specific soft skills and a wealth of knowledge.

Good luck and enjoy the ride,

How to Become a VMware Certified Design Expert (VCDX)

What are the steps to becoming a VCDX?

- Be a VCP on VI 3.
- Take the Enterprise-Level System Admin Exam (Now Available)
- Take the Design Exam (Available Late August)
- Submit and defend a successful VMware Infrastructure design plan.

http://mylearn1.vmware.com/portals/certification/Certification News:
VMware Certification Exams Available at VMworld 2009
VMware will be offering certifications exams at VMworld 2009 in San Francisco.

To register please visit Pearson VUE’s website.

Please note: VCDX Enterprise Administration Exam and Design Exams are offered by authorization only. Those interested should review the “How to Become a VCDX” section on this website for more information.
VMware Certified Professional on vSphere™ 4
With the launch of vSphere™ 4, a new certification will be available. The VMware Certified Professional on vSphere™ 4 beta exam will be available June 29th, 2009. Candidates eligible for the beta exam will automatically be contacted by VMware. These candidates must be VCP3 certified and beta product users. The VCP on vSphere 4 (VCP4) exam will be available publicly on August 8th, 2009.

There are four possible paths to achieve VCP4
If you are NEW to VMware
Attend the VMware vSphere: Install, Configure, Manage course OR attend the VMware vSphere 4: Fast Track (available in Q4)
Take and pass the VCP4 exam
If you are currently a VCP3
Take and pass the VCP4 exam. This option will only be available until December 31, 2009. The What’s New class is strongly recommended. Beginning in 2010, VCP3s must attend the VMware vSphere 4: What’s New class in order to upgrade.
If you are currently a VCP2
Take and pass the VCP on VMware Infrastructure 3 exam
Take and pass the VCP4 Exam. This option will only be available until December 31, 2009. Beginning in 2010, VCP3s must attend the VMware vSphere: What’s New class in order to upgrade.
Beginning in 2010, VCP2s who have not upgraded will be required to attend the VMware vSphere: Install, Configure, Manage or VMware vSphere: Fast Track course
If you are not a VCP3, but have attended one of the prerequisite classes (VI3: Install & Configure; VI3: Deploy Secure & Analyze; or VI3: Fast Track).
Take and pass the VCP3 exam OR attend the VMware vSphere4: What’s New course.
Take and pass the VCP4 Exam.
…more info
Purchase VCP Exam Vouchers with your Credits
We are pleased to announce that customers with VMware Consulting and Training Credits can now use their credits to purchase VMware Certified Professional (VCP) Exams. To purchase your voucher(s) please visit http://mylearn.vmware.com/examvoucher.
Donwload Free PassGuide Braindumps-The Most Realistic Practice Questions and Answers,Help You Pass any Exams

How to become a VMware Certified Professional (VI3)

Becoming a VMware Certified Professional is a straightforward, three-step process:
Participate in a VMware authorized course that is instructor-led to learn best practices and gain hands-on experience. The accepted courses are:
VMware Infrastructure 3: Install and Configure V3.5
VMware Infrastructure 3: Deploy, Secure and Analyze V3.5
VMware Infrastructure 3: Fast Track V3.5
If you are a current VCP, there are no course prerequisites.
Gain hands-on experience with VMware. Individuals who do not have the hands on experience find it very difficult to pass the exam.
Enroll and pass the certification exam. To register to take the VMware Certified Professional examination please contact Pearson VUE, a third-party testing center at www.pearsonvue.com/vmware

Certification Benefits
Demonstrate your VMware software technical expertise to employers and customers
Increase your potential for career advancement
Use the VMware Certified Professional logo on your business card or website
Receive a complimentary license for VMware Workstation for Windows or Linux
How to become a VMware Certified Design Expert (VI3)

There are four core validation components to achieve VCDX
Must be certified as a VMware Certified Professional (VCP) on VMware Infrastructure 3.
Pass the VMware Enterprise Administration Exam. Includes live labs and tests a higher level of skill set than the exam for VCP on VMware Infrastructure 3.
Pass the VMware Design Exam. This exam focuses on actual design scenarios and contains simulations and situational questions.
Submit, present and defend a successful VMware Infrastructure design and implementation plan.

To get started, you must complete the Qualification Skills Review

Certification Benefits
Sets expectations of a high level of confidence
Enables partners to distinguish themselves
Helps give customers confidence in consulting capabilities
Use the VMware Certified Design Expert logo on your business card or website

Monday 12 April 2010

Get-VmwareSnaphots.ps1

------

@"

===============================================================================

Title: Get-VmwareSnaphots.ps1

Description: List snapshots on all VMWARE ESX/ESXi servers as well as VM's managed by Virtual Center.

Requirements: Windows Powershell and the VI Toolkit

Usage: .\Get-VmwareSnaphots.ps1

Author: Last Updated by Sravan Kumar E

===============================================================================

"@



#Global Functions

#This function generates a nice HTML output that uses CSS for style formatting.

function Generate-Report {

Write-Output ""



Foreach ($snapshot in $report){

Write-Output " "

}

Write-Output "
VMware Snaphot Report
VM Name Snapshot Name Date Created Description Host
$($snapshot.vm)$($snapshot.name)$($snapshot.created)$($snapshot.description)$($snapshot.host)
"

}



#Login details for standalone ESXi servers

$username = 'administrator'

$password = 'password' #Change to the root password you set for you ESXi server



#List of servers including Virtual Center Server. The account this script will run as will need at least Read-Only access to Cirtual Center

$ServerList = "10.91.42.21" #Chance to DNS Names/IP addresses of your ESXi servers or Virtual Center Server



#Initialise Array

$Report = @()



#Get snapshots from all servers

foreach ($server in $serverlist){



# Check is server is a Virtual Center Server and connect with current user

if ($server -eq "10.91.42.21"){Connect-VIServer $server}



# Use specific login details for the rest of servers in $serverlist

else {Connect-VIServer $server -user $username -password $password}





get-vm | get-snapshot | %{

$Snap = {} | Select VM,Name,Created,Description,Host

$Snap.VM = $_.vm.name

$Snap.Name = $_.name

$Snap.Created = $_.created

$Snap.Description = $_.description

$Snap.Host = $_.vm.host.name

$Report += $Snap

}

}



# Generate the report and email it as a HTML body of an email

Generate-Report > "VmwareSnapshots.html"

IF ($Report -ne ""){

$SmtpClient = New-Object system.net.mail.smtpClient

$SmtpClient.host = "10.91.40.35" #Change to a SMTP server in your environment

$MailMessage = New-Object system.net.mail.mailmessage

$MailMessage.from = "VM-Snapshots@mach.com" #Change to email address you want emails to be coming from

$MailMessage.To.add("rere@mach.com") #Change to email address you would like to receive emails.

$MailMessage.IsBodyHtml = 1

$MailMessage.Subject = "Vmware Snapshots"

$MailMessage.Body = Generate-Report

$SmtpClient.Send($MailMessage)}



-------

Wednesday 10 February 2010

Disabling The Shutdown Event Tracker

A new feature in Windows Server 2003 is the "Shutdown Event Tracker" which requires you to provide a reason for each manually-requested shutdown. This information then gets written into the event log.
If your server is not mission-critical, you may want to turn this feature off.

To turn off the Shutdown Event Tracker, navigate to the following key in your registry:

HKLM\SOFTWARE\Policies\Microsoft\Windows NT\Reliability
(You may need to create the Reliability key)

Insert or change a value with the following:

Data Type: DWORD
Value Name: ShutdownReasonOn
Value: 0

The change will take place immediately

Disable Printer Events In The Event Log

If you don't want to see a printer notification event in the event log you can disable that..

Start regedit and find the key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Providers".
Add "Eventlog" and set the value "Reg_DWORD" at "0".

Wednesday 20 January 2010

Unable to configure NTP from the Virtual Infrastructure Client

Symptoms
  • During the configuration of NTP settings from the Virtual Infrastructure Client (VI Client) in VirtualCenter 2.5 configuration fails and the error failed to change host configuration is displayed.

Purpose

Overview

The ability to configure NTP from the VI Client has been added in VirtualCenter 2.5 and ESX Server 3.5.

Configuration of NTP from the VI Client fails if the ESX Server host is configured to use a non-standard timezone as listed in the timezone description file. For example, if your server is set to ETC/GMT-5 instead of America/New_York configuration of NTP fails.

Upon further inspection of the /var/log/vmware/hostd.log on the ESX Server host, warnings similar to the following are displayed:

  • Timezone '' not part of the tz database using the default timezone UTC , where is the value of that is being used for the timezone. For example, ETC/GMT-5.
  • Timezone 'UTC' does not exist in the tz database.

Resolution

Note: Before you begin please refer to KB1003490for important information on restarting the mgmt-vmware service.

Verification of the problem

To check which timezone is being used on the ESX Server host:

  1. Log in to your ESX Server host as root from either an SSH session or directly from the console of the server.
  2. Type cat /etc/sysconfig/clock.

An output similar to the following appears:

[root@server]# cat /etc/sysconfig/clock
ZONE="America/New_York"
UTC=true
ARC=false
[root@server]#

The timezone is listed in the ZONE= section of the output. Compare this value to the information listed in the TZ column of the /usr/share/zoneinfo/zone.tab file.


Note: All values are case sensitive. Ensure that the case is the same between the the clock file and the zone.tab file.

From the example above, when you look in the /usr/share/zoneinfo/zone.tab file, you see:

#country-
#code coordinates TZ comments

US +404251-0740023 America/New_York Eastern Time

If the value is not listed and you receive an error message, follow the steps in the workaround. If the value is listed in this file and you are still receiving this error message please contact VMware Support referencing this KB article for further assistance diagnosing the problem.

Workaround

To workaround this problem you need to ensure that your timezone is set to a value that is listed in the /usr/share/zoneinfo/zone.tab file.

Follow these steps to correct the behavior:

  1. Log in to your ESX Server host as root from either an SSH session or directly from the console of the server.
  2. Type less /usr/share/zoneinfo/zone.tab .
  3. Review this file until you find the appropriate timezone. Take note of the value listed in the TZ column of this file. For example, America/New_York in the example listed in the verification section of this article.
  4. Press the Q key to quit from less.
  5. Type nano /etc/sysconfig/clock .
  6. Change the ZONE= section of this file to be the value noted in Step 3.

    Note: All values are case sensitive. Ensure that the case is the same between the clock file and the zone.tab file.
  7. Press Ctrl + X and save the changes when prompted.
  8. Type service mgmt-vmware restart .

    Caution: Ensure Automatic Startup/Shutdown of virtual machines is disabled before running this command or you risk rebooting the virtual machines. For more information, see Restarting hostd (mgmt-vmware) on ESX Server Hosts Restarts Hosted Virtual Machines Where Virtual Machine Startup/Shutdown is Enabled (1003312) .

Friday 15 January 2010

To Know Which Linux Distribution We Are Using

From the Boot Time messages
Fire up your favourite terminal program and type in the following

dmesg | head -1

Using /proc/version
In the terminal type

cat /proc/version

Using /etc/issue
This method gives the most appropriate answer

cat /etc/issue

Monday 11 January 2010

FTP Automation

Make a text file that contains your ftp instructions...

OPEN my.ftp.com
mylogin
mypassword
binary
MPUT mylog.rar
BYE

Make a bat file that executes it...

ftp -i -s:C:\script_daily.txt

Saturday 9 January 2010

Fix for Login failed for user “. The user is not associated with a trusted SQL Server Connection:

To set the DisableLoopbackCheck registry key yourself, follow these steps:
  1. Click Start, click Run, type regedit, and then click OK.
  2. In Registry Editor, locate and then click the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa
  3. Right-click Lsa, point to New, and then click DWORD Value.
  4. Type DisableLoopbackCheck, and then press ENTER.
  5. Right-click DisableLoopbackCheck, and then click Modify.
  6. In the Value data box, type 1, and then click OK.
  7. Quit Registry Editor, and then restart your computer.
--------------------------------------

Wehould now find that the connection will complete successfully. Another place to check is in event viewer. For this particular error we had 3 events logged in event viewer:

1. Failure Audit :: Login Failed for user ‘\’. (CLIENT 127.0.0.1)

2. Error :: SSPI handshake failed with error code 0×8009030C while establishing a connection with integrated security; the connection has been closed. (CLIENT 127.0.0.1)

3. Failure Audit :: Login Failed for user “. (CLIENT 127.0.0.1)

--------------------------------------