Automation using power cli
-
Upload
esarakaitis -
Category
Documents
-
view
753 -
download
5
Transcript of Automation using power cli
![Page 1: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/1.jpg)
Automa'on Using PowerCLI
Eric Wannemacher
![Page 2: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/2.jpg)
h9p://upload.wikimedia.org/wikipedia/commons/thumb/5/52/Atlas_San'ago_Toural_GFDL.jpg/220px-‐Atlas_San'ago_Toural_GFDL.jpg
![Page 3: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/3.jpg)
Give me a lever long enough and a fulcrum on which to place it, and I shall move the world. Archimedes
![Page 4: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/4.jpg)
![Page 5: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/5.jpg)
![Page 6: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/6.jpg)
![Page 7: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/7.jpg)
![Page 8: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/8.jpg)
![Page 9: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/9.jpg)
![Page 10: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/10.jpg)
vs.
![Page 11: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/11.jpg)
How Do I Use It?
• Things that are boring/repe''ve – Server builds – LUN migra'ons – Changing seRngs across many hosts/VMs – Reports for management/other teams – Managing mul'ple vCenters
• Things I should do, but may not otherwise – Configura'on monitoring – Log review
![Page 12: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/12.jpg)
GeRng Started
• Install PowerShell (v2 if possible) • Run “Set-‐Execu'onPolicy RemoteSigned”
• Install PowerCLI 4.0 U1 (Maybe 4.1)
• Connect-‐VIServer <host or vCenter> • MAGIC
• Disconnect-‐VIServer
![Page 13: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/13.jpg)
Demo Recipes
h9p://upload.wikimedia.org/wikipedia/commons/thumb/3/3d/Cheese_Soup_Recipe.jpg/800px-‐Cheese_Soup_Recipe.jpg
![Page 14: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/14.jpg)
Making Toast
# List all VMs Get-VM
# Get one VM Get-VM ubuntu01
# Get VMs that match Get-VM ubuntu*
![Page 15: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/15.jpg)
Boiling an Egg
# List VMs in a Datacenter
Get-Datacenter dc001 | Get-VM
# List VMs in a cluster
Get-Cluster dc001 | Get-VM
![Page 16: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/16.jpg)
Sieing Through What You Have
# Get 2 CPU or larger VMs Get-VM | Where-Object {$_.NumCPU -ge 2}
# Get 2 GB RAM or larger VMs Get-VM | Where-Object {$_.MemoryMB -ge 2048}
![Page 17: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/17.jpg)
Available Ingredients
Get-Command Get-VICommand Summarized By Noun h9p://wannemacher.us/?p=315
Get-Help Get-VM
Get-Member Get-VM | Get-Member
![Page 18: Automation using power cli](https://reader034.fdocuments.net/reader034/viewer/2022051314/5560b83dd8b42aef3b8b4b36/html5/thumbnails/18.jpg)
Addi'onal Info
• Local Resources – h9p://vmwarescrip'ng.com
– h9p://wannemacher.us
• Other – Managing VMware Infrastructure with Windows PowerShell TFM
– The VMware Community Forums (LucD) – Google