VI Toolkit/ PowerShell for VMware

download VI Toolkit/ PowerShell  for VMware

of 25

  • date post

    22-Feb-2016
  • Category

    Documents

  • view

    43
  • download

    1

Embed Size (px)

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 Presentation

Transcript of VI Toolkit/ PowerShell for VMware

Slide 1

VI Toolkit/PowerShell for VMware

Randy SnyderMicrosoft PowerShellCommand line shell and scripting languageDownload Windows PowerShell 1.0 and install http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspxOpen a command prompt

http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx

2Microsoft 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 ToolkitNew 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

http://teckinfo.blogspot.com/2009/02/vi-toolkit-quick-reference-guide.html

6Get-Help command -detailed

Getting Started

What can I do?

PowerGUI

http://powergui.org/index.jspa 10Connecting

Viewing information

Viewing the Source

The ProblemNeed to get data from a number of serversData is not in a script that I could findField is not somewhere I would normally lookFinding DataGet-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

Summary Property VMware.Vim.VirtualMachineSummary Summary {get;}

16($vm | get-view).summary | get-member

Vm Property VMware.Vim.ManagedObjectReference Vm {get;set;}17 ($vm | get-view).summary.vm | get-member

Value Property System.String Value {get;set;}18($vm | get-view).summary.vm

($vm | get-view).summary.vm19Writing the Script

Step 1 Connect #Set variables $vcserver = insert VC Server Name#Connect to VC$VC = Connect-VIServer $VCServerLoop 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 IPs

Additional ResourcesVMware Administrators guide for VI Toolkit 1.5Undocumented FeaturesReal Time PublishersVI-Toolkit.comPowerScripting PodcastPower of Shell