vi toolkit/ powershell for vmware
DESCRIPTION
VI Toolkit/ PowerShell for VMware. Randy Snyder. Microsoft PowerShell. Command line shell and scripting language Download Windows PowerShell 1.0 and install http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx Open a command prompt . - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/1.jpg)
VI Toolkit/PowerShell for VMware
Randy Snyder
![Page 2: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/2.jpg)
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
![Page 3: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/3.jpg)
Microsoft PowerShell
![Page 4: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/4.jpg)
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..)
![Page 5: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/5.jpg)
Microsoft PowerShell
![Page 6: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/6.jpg)
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
![Page 7: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/7.jpg)
Get-Help “command” -detailed
![Page 8: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/8.jpg)
Getting Started
![Page 9: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/9.jpg)
What can I do?
![Page 10: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/10.jpg)
PowerGUI
![Page 11: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/11.jpg)
Connecting
![Page 12: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/12.jpg)
Viewing information
![Page 13: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/13.jpg)
Viewing the Source
![Page 14: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/14.jpg)
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
![Page 15: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/15.jpg)
Finding Data
Get-VM vm_name | get-view | format-custom >c:\out.txt Summary = class VirtualMachineSummary { Vm = class ManagedObjectReference { Type = VirtualMachine Value = vm-149535 }
![Page 16: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/16.jpg)
($vm | get-view) | get-member
![Page 17: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/17.jpg)
($vm | get-view).summary | get-member
![Page 18: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/18.jpg)
($vm | get-view).summary.vm | get-member
![Page 19: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/19.jpg)
($vm | get-view).summary.vm
![Page 20: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/20.jpg)
Writing the Script
![Page 21: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/21.jpg)
Step 1 Connect
#Set variables $vcserver = “insert VC Server Name“#Connect to VC$VC = Connect-VIServer $VCServer
![Page 22: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/22.jpg)
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
}
![Page 23: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/23.jpg)
Results
![Page 24: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/24.jpg)
Vmotion IP’s
![Page 25: VI Toolkit/ PowerShell for VMware](https://reader036.vdocuments.us/reader036/viewer/2022062305/56816213550346895dd23e82/html5/thumbnails/25.jpg)
Additional Resources
VMware Administrator’s guide for VI Toolkit 1.5Undocumented FeaturesReal Time PublishersVI-Toolkit.comPowerScripting PodcastPower of Shell