VI Toolkit/ PowerShell for VMware
description
Transcript of VI Toolkit/ PowerShell for VMware
VI Toolkit/PowerShell for VMware
Randy Snyder
Microsoft PowerShell
Command line shell and scripting languageDownload Windows PowerShell 1.0 and install http://www.microsoft.com/windowsserver2003/
technologies/management/powershell/default.mspx
Open a command prompt
Microsoft PowerShell
Next steps
Get-HelpCan use tabbing to finish commandsCommands like ls, pwd, dir etc… work Files are saved as a .PS1Not only for Windows, (VMware, Quest, F5, Full
Armor etc..)
Microsoft PowerShell
VMware VI Toolkit
New version release January 28, 2009Quick Reference GuideVMware forumVMware Europe Labhttp://www.vmwarescripting.com/http://www.peetersonline.nl/http://www.ntpro.nl/blog/categories/10-VMware-PowerShell
Get-Help “command” -detailed
Getting Started
What can I do?
PowerGUI
Connecting
Viewing information
Viewing the Source
The Problem
• Need to get data from a number of servers• Data is not in a script that I could find• Field is not somewhere I would normally look
Finding Data
Get-VM vm_name | get-view | format-custom >c:\out.txt Summary = class VirtualMachineSummary { Vm = class ManagedObjectReference { Type = VirtualMachine Value = vm-149535 }
($vm | get-view) | get-member
($vm | get-view).summary | get-member
($vm | get-view).summary.vm | get-member
($vm | get-view).summary.vm
Writing the Script
Step 1 Connect
#Set variables $vcserver = “insert VC Server Name“#Connect to VC$VC = Connect-VIServer $VCServer
Loop the command
#Tell it to loop through the namesforeach ($object in $vmname){
#Provide the command to increase the RAM $vm = Get-VM $object ($vm | Get-View).summary.vm.value + " " +
$vm.name
}
Results
Vmotion IP’s
Additional Resources
VMware Administrator’s guide for VI Toolkit 1.5Undocumented FeaturesReal Time PublishersVI-Toolkit.comPowerScripting PodcastPower of Shell