SlideShare a Scribd company logo
1 of 16
VMware PowerCLI
Introduction, Performace Tweaks and Specials
Speaker Introduction
Web: mycloudrevolution.com
Twitter: @vMarkus_K
Work: QSC AG (Hamburg)
Table of Content
• Introduction to VMware PowerCLI
• Demo
• Performance Tweaks
• PowerCLI Special
• VM IDs
• Q&A
Introduction
PowerShell vs. PowerShell Core
Introduction
Modules
• The Core-Module is for VMware vSphere
Introduction
Community
PowerNSX (Core)
PowerVRA / PowerVRO
PowerVRNI
Introduction
Community
https://powercli.ideas.aha.io/
Demo
Basics
# Init
## Import VMware Modules
Get-Module -Name VMware* -ListAvailable | Import-Module
## Connect vCenter
Connect-VIServer vcenter-01.lab.local
## Prepare VMs
$sourceVMName = "test"
For ($i=1; $i -le 20; $i++) {
$newVMName = [String]($sourceVMName + $i)
New-VM -Name $newVMName -VM $sourceVMName -VMHost "esxi-01.lab.local" -Datastore "vol_vmware_01" -DiskStorageFormat Thin
}
• Load Module
• Connect vCenter or ESXi Host
• [Clone Lab VMs]
Demo
Performance Tweaks
• Methods!
• Get-VM vs. Get-View
# Perf - Methoden / Get-View mit Filter
## Init Array of VMs
$VMs = Get-VM
## Where-Object Cmdlet
Measure-Command { $VMs | Where-Object {$_.Name -eq "test"} }
## Where Methode
Measure-Command { $VMs.Where({$_.Name -eq "test"}) }
## Where Split
$VMsOn, $VMsOff = $VMs.Where({$_.PowerState -eq "PoweredOn"}, "Split")
$VMsOn.Count
$VMsOff.Count
## Get-View mit Filter gegen Get-VM mit Where-Object
Measure-Command {Get-VM -Name "test" | fl}
Measure-Command {Get-View -ViewType VirtualMachine -Filter @{Name="^test"} | fl}
Demo
Performance Tweaks – Results in larger scale
• Test with 227 Hosts / 2551 VMs
Demo
PowerCLI Special - PSDrive to VMware Datastore
• Mount VMware Datastore as a PSDrive
[String]$LocalPath = "C:tempdummy.txt"
[String]$TempDatastoreName = "*local"
[Array]$VMhosts = Get-VMHost
$VMhosts.ForEach({
$Datastore = $_| Get-Datastore -Name $TempDatastoreName
$DatastoreDriveName = "HostStore_" + $_.Name.Split(".")[0]
$Datastore | New-DatastoreDrive -Name $DatastoreDriveName | Out-Null
Copy-DatastoreItem -Item $LocalPath -Destination $($DatastoreDriveName + ":") -Force:$true -Confirm:$false
Remove-PSDrive -Name $DatastoreDriveName
})
Demo
PowerCLI Special – ESXCLI -V2
• Example: Patch installation
• Native PowerCLI Cmdlet does only upgrade packages
• ESXCLI can do up- and downgrade of packages
# ESXCLI -V2
$VMHost = $VMHosts | select -First 1
$Datastore = $VMHost | Get-Datastore -Name $TempDatastoreName
$HostPath = $Datastore.ExtensionData.Info.Url.remove(0,5) + $LocalPath.Split("")[-1]
## Install-VMhost
Install-VMHostPatch -VMHost $VMHost -HostPath $HostPath
## ESXCLI V2
$esxcli2 = Get-ESXCLI -VMHost $VMhost -V2
### List
$esxcli2.software.vib.list.Invoke() | FT -AutoSize
### Install
$CreateArgs = $esxcli2.software.vib.install.CreateArgs()
$CreateArgs.depot = $HostPath
$InstallResponse = $esxcli2.software.vib.install.Invoke($CreateArgs)
Demo
PowerCLI Special – Invoke-VMScript
• Enhanced: Invoke-VMScriptPlus V2
(http://www.lucd.info/2018/08/05/invoke-vmscriptplus-v2/)
• Multi-Line Scripts
• More Script-Types
$Pass = ConvertTo-SecureString 'Passw0rd!' -AsPlainText -Force
$sInvP = @{
VM = 'PhotonOS'
ScriptType = 'Bash'
ScriptText = $code
GuestOSType = 'Linux'
GuestUser = 'root'
GuestPassword = $Pass
}
Invoke-VMScriptPlus @sInvP
Demo
VM IDs – Basics
• UUID
uuid.bios / Generated by ESXi Host / Known by Guest OS as BIOS UUID
• InstanceUUID
vc.uuid / Generated by vCenter
• LocationsID
uuid.location / Hash of VMX File and ESXi UUID / vCenter needs this to idenfy third party changes to
the VM
• MoRef
Managed Object Reference / Generated by vCenter / Used by MOB, APIs and vCenter
Get-VM -Name "Veeam-03" | Get-VMID
Demo
VM IDs – Identify Guest OS
$sInvP = @{
VM = 'Veeam-03'
ScriptType = 'PowerShell'
GuestOSType = 'Windows'
ScriptText = $code
GuestCredential = $cred
}
Remove-Variable UUIDwin, UUIDreturn -ErrorAction SilentlyContinue
$UUIDreturn = Invoke-VMScriptPlus @sInvP
[String]$UUIDwin = $UUIDreturn.ScriptOutput
Convert-UUID -UUIDwin $UUIDwin
Get-VM -Name "Veeam-03" | Get-VMID | select UUID
• Match Guest OS to vSphere VM
Q&A

More Related Content

What's hot

Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningUchit Vyas ☁
 
PowerCLI for the PowerShell Inclined
PowerCLI for the PowerShell InclinedPowerCLI for the PowerShell Inclined
PowerCLI for the PowerShell InclinedJosh Atwell
 
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David KarbanAnsible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David Karbanansiblebrno
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of PackerFreyr Lin
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraFormWesley Charles Blake
 
VSTS/ TFS automated Release Pipelines for Web Applications with Docker
VSTS/ TFS automated Release Pipelines for Web Applications with DockerVSTS/ TFS automated Release Pipelines for Web Applications with Docker
VSTS/ TFS automated Release Pipelines for Web Applications with DockerMarc Müller
 
Configuration management and deployment with ansible
Configuration management and deployment with ansibleConfiguration management and deployment with ansible
Configuration management and deployment with ansibleIvan Dimitrov
 
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013Puppet
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackke4qqq
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStackke4qqq
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStackPuppet
 
개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive창훈 정
 
Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Martin Schütte
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Jeff Geerling
 
Getting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeAJ Morris
 

What's hot (20)

Rapid Infrastructure Provisioning
Rapid Infrastructure ProvisioningRapid Infrastructure Provisioning
Rapid Infrastructure Provisioning
 
ansible why ?
ansible why ?ansible why ?
ansible why ?
 
PowerCLI for the PowerShell Inclined
PowerCLI for the PowerShell InclinedPowerCLI for the PowerShell Inclined
PowerCLI for the PowerShell Inclined
 
Ansible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David KarbanAnsible Introduction - Ansible Brno #1 - David Karban
Ansible Introduction - Ansible Brno #1 - David Karban
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of Packer
 
Automation with Packer and TerraForm
Automation with Packer and TerraFormAutomation with Packer and TerraForm
Automation with Packer and TerraForm
 
VSTS/ TFS automated Release Pipelines for Web Applications with Docker
VSTS/ TFS automated Release Pipelines for Web Applications with DockerVSTS/ TFS automated Release Pipelines for Web Applications with Docker
VSTS/ TFS automated Release Pipelines for Web Applications with Docker
 
Configuration management and deployment with ansible
Configuration management and deployment with ansibleConfiguration management and deployment with ansible
Configuration management and deployment with ansible
 
Packer
Packer Packer
Packer
 
Bosh 2.0
Bosh 2.0Bosh 2.0
Bosh 2.0
 
wp cli
wp cliwp cli
wp cli
 
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
Deploying VMware vCloud Hybrid Service with Puppet - PuppetConf 2013
 
Infrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStackInfrastructure as code with Puppet and Apache CloudStack
Infrastructure as code with Puppet and Apache CloudStack
 
Puppet and CloudStack
Puppet and CloudStackPuppet and CloudStack
Puppet and CloudStack
 
Ansible
AnsibleAnsible
Ansible
 
Puppet and Apache CloudStack
Puppet and Apache CloudStackPuppet and Apache CloudStack
Puppet and Apache CloudStack
 
개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive개발자를 위한 Amazon Lightsail Deep-Dive
개발자를 위한 Amazon Lightsail Deep-Dive
 
Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)Terraform: Cloud Configuration Management (WTC/IPC'16)
Terraform: Cloud Configuration Management (WTC/IPC'16)
 
Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2Ansible 2 and Ansible Galaxy 2
Ansible 2 and Ansible Galaxy 2
 
Getting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your lifeGetting Started with WP-CLI, a tool to automate your life
Getting Started with WP-CLI, a tool to automate your life
 

Similar to PowerShell User Group Hamburg - PowerCLI

Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorAutomating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorDigicomp Academy AG
 
Automating Azure VMs with PowerShell
Automating Azure VMs with PowerShellAutomating Azure VMs with PowerShell
Automating Azure VMs with PowerShellAlexander Feschenko
 
Provisioning in Microsoft Azure
Provisioning in Microsoft AzureProvisioning in Microsoft Azure
Provisioning in Microsoft Azureilagin
 
Itb session v_memcached
Itb session v_memcachedItb session v_memcached
Itb session v_memcachedSkills Matter
 
Poster vmware-management-with-vcli-5.0
Poster vmware-management-with-vcli-5.0Poster vmware-management-with-vcli-5.0
Poster vmware-management-with-vcli-5.0Fredy Ricse
 
Automating Windows Azure
Automating Windows AzureAutomating Windows Azure
Automating Windows AzureIdo Flatow
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHErica Windisch
 
Building cloud stack at scale
Building cloud stack at scaleBuilding cloud stack at scale
Building cloud stack at scaleShapeBlue
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShellDale Lane
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4Google App Engine Developer - Day4
Google App Engine Developer - Day4Simon Su
 
Power Cli Workshop London Vmug
Power Cli Workshop London VmugPower Cli Workshop London Vmug
Power Cli Workshop London Vmugjonathanmedd
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endEzequiel Maraschio
 
SharePoint Administration with PowerShell
SharePoint Administration with PowerShellSharePoint Administration with PowerShell
SharePoint Administration with PowerShellEric Kraus
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environmentSumedt Jitpukdebodin
 
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLONPaul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLONOutlyer
 
Enrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique Lima
 
Mmik_Powershell_DSC_Azure_DSC
Mmik_Powershell_DSC_Azure_DSCMmik_Powershell_DSC_Azure_DSC
Mmik_Powershell_DSC_Azure_DSCMmik Huang
 
Mmik powershell dsc_slideshare_v1
Mmik powershell dsc_slideshare_v1Mmik powershell dsc_slideshare_v1
Mmik powershell dsc_slideshare_v1Mmik Huang
 

Similar to PowerShell User Group Hamburg - PowerCLI (20)

Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and OrchestratorAutomating OSD and Post-OSD Configuration with Powershell and Orchestrator
Automating OSD and Post-OSD Configuration with Powershell and Orchestrator
 
Automating Azure VMs with PowerShell
Automating Azure VMs with PowerShellAutomating Azure VMs with PowerShell
Automating Azure VMs with PowerShell
 
Provisioning in Microsoft Azure
Provisioning in Microsoft AzureProvisioning in Microsoft Azure
Provisioning in Microsoft Azure
 
Deploying SharePoint @ Cloud
Deploying SharePoint @ CloudDeploying SharePoint @ Cloud
Deploying SharePoint @ Cloud
 
Itb session v_memcached
Itb session v_memcachedItb session v_memcached
Itb session v_memcached
 
Poster vmware-management-with-vcli-5.0
Poster vmware-management-with-vcli-5.0Poster vmware-management-with-vcli-5.0
Poster vmware-management-with-vcli-5.0
 
Automating Windows Azure
Automating Windows AzureAutomating Windows Azure
Automating Windows Azure
 
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGHDeploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
Deploying Docker (Provisioning /w Docker + Chef/Puppet) - DevopsDaysPGH
 
Building cloud stack at scale
Building cloud stack at scaleBuilding cloud stack at scale
Building cloud stack at scale
 
An Introduction to Windows PowerShell
An Introduction to Windows PowerShellAn Introduction to Windows PowerShell
An Introduction to Windows PowerShell
 
Google App Engine Developer - Day4
Google App Engine Developer - Day4Google App Engine Developer - Day4
Google App Engine Developer - Day4
 
VMworld 2011 - PowerCLI 101
VMworld 2011 - PowerCLI 101VMworld 2011 - PowerCLI 101
VMworld 2011 - PowerCLI 101
 
Power Cli Workshop London Vmug
Power Cli Workshop London VmugPower Cli Workshop London Vmug
Power Cli Workshop London Vmug
 
Fullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-endFullstack conf 2017 - Basic dev pipeline end-to-end
Fullstack conf 2017 - Basic dev pipeline end-to-end
 
SharePoint Administration with PowerShell
SharePoint Administration with PowerShellSharePoint Administration with PowerShell
SharePoint Administration with PowerShell
 
How to create your own hack environment
How to create your own hack environmentHow to create your own hack environment
How to create your own hack environment
 
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLONPaul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
Paul Angus (ShapeBlue) - Push infrastructure with Ansible #DOXLON
 
Enrique lima azure-it-pro-ps
Enrique lima azure-it-pro-psEnrique lima azure-it-pro-ps
Enrique lima azure-it-pro-ps
 
Mmik_Powershell_DSC_Azure_DSC
Mmik_Powershell_DSC_Azure_DSCMmik_Powershell_DSC_Azure_DSC
Mmik_Powershell_DSC_Azure_DSC
 
Mmik powershell dsc_slideshare_v1
Mmik powershell dsc_slideshare_v1Mmik powershell dsc_slideshare_v1
Mmik powershell dsc_slideshare_v1
 

Recently uploaded

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamUiPathCommunity
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 

Recently uploaded (20)

MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 

PowerShell User Group Hamburg - PowerCLI

  • 3. Table of Content • Introduction to VMware PowerCLI • Demo • Performance Tweaks • PowerCLI Special • VM IDs • Q&A
  • 8. Demo Basics # Init ## Import VMware Modules Get-Module -Name VMware* -ListAvailable | Import-Module ## Connect vCenter Connect-VIServer vcenter-01.lab.local ## Prepare VMs $sourceVMName = "test" For ($i=1; $i -le 20; $i++) { $newVMName = [String]($sourceVMName + $i) New-VM -Name $newVMName -VM $sourceVMName -VMHost "esxi-01.lab.local" -Datastore "vol_vmware_01" -DiskStorageFormat Thin } • Load Module • Connect vCenter or ESXi Host • [Clone Lab VMs]
  • 9. Demo Performance Tweaks • Methods! • Get-VM vs. Get-View # Perf - Methoden / Get-View mit Filter ## Init Array of VMs $VMs = Get-VM ## Where-Object Cmdlet Measure-Command { $VMs | Where-Object {$_.Name -eq "test"} } ## Where Methode Measure-Command { $VMs.Where({$_.Name -eq "test"}) } ## Where Split $VMsOn, $VMsOff = $VMs.Where({$_.PowerState -eq "PoweredOn"}, "Split") $VMsOn.Count $VMsOff.Count ## Get-View mit Filter gegen Get-VM mit Where-Object Measure-Command {Get-VM -Name "test" | fl} Measure-Command {Get-View -ViewType VirtualMachine -Filter @{Name="^test"} | fl}
  • 10. Demo Performance Tweaks – Results in larger scale • Test with 227 Hosts / 2551 VMs
  • 11. Demo PowerCLI Special - PSDrive to VMware Datastore • Mount VMware Datastore as a PSDrive [String]$LocalPath = "C:tempdummy.txt" [String]$TempDatastoreName = "*local" [Array]$VMhosts = Get-VMHost $VMhosts.ForEach({ $Datastore = $_| Get-Datastore -Name $TempDatastoreName $DatastoreDriveName = "HostStore_" + $_.Name.Split(".")[0] $Datastore | New-DatastoreDrive -Name $DatastoreDriveName | Out-Null Copy-DatastoreItem -Item $LocalPath -Destination $($DatastoreDriveName + ":") -Force:$true -Confirm:$false Remove-PSDrive -Name $DatastoreDriveName })
  • 12. Demo PowerCLI Special – ESXCLI -V2 • Example: Patch installation • Native PowerCLI Cmdlet does only upgrade packages • ESXCLI can do up- and downgrade of packages # ESXCLI -V2 $VMHost = $VMHosts | select -First 1 $Datastore = $VMHost | Get-Datastore -Name $TempDatastoreName $HostPath = $Datastore.ExtensionData.Info.Url.remove(0,5) + $LocalPath.Split("")[-1] ## Install-VMhost Install-VMHostPatch -VMHost $VMHost -HostPath $HostPath ## ESXCLI V2 $esxcli2 = Get-ESXCLI -VMHost $VMhost -V2 ### List $esxcli2.software.vib.list.Invoke() | FT -AutoSize ### Install $CreateArgs = $esxcli2.software.vib.install.CreateArgs() $CreateArgs.depot = $HostPath $InstallResponse = $esxcli2.software.vib.install.Invoke($CreateArgs)
  • 13. Demo PowerCLI Special – Invoke-VMScript • Enhanced: Invoke-VMScriptPlus V2 (http://www.lucd.info/2018/08/05/invoke-vmscriptplus-v2/) • Multi-Line Scripts • More Script-Types $Pass = ConvertTo-SecureString 'Passw0rd!' -AsPlainText -Force $sInvP = @{ VM = 'PhotonOS' ScriptType = 'Bash' ScriptText = $code GuestOSType = 'Linux' GuestUser = 'root' GuestPassword = $Pass } Invoke-VMScriptPlus @sInvP
  • 14. Demo VM IDs – Basics • UUID uuid.bios / Generated by ESXi Host / Known by Guest OS as BIOS UUID • InstanceUUID vc.uuid / Generated by vCenter • LocationsID uuid.location / Hash of VMX File and ESXi UUID / vCenter needs this to idenfy third party changes to the VM • MoRef Managed Object Reference / Generated by vCenter / Used by MOB, APIs and vCenter Get-VM -Name "Veeam-03" | Get-VMID
  • 15. Demo VM IDs – Identify Guest OS $sInvP = @{ VM = 'Veeam-03' ScriptType = 'PowerShell' GuestOSType = 'Windows' ScriptText = $code GuestCredential = $cred } Remove-Variable UUIDwin, UUIDreturn -ErrorAction SilentlyContinue $UUIDreturn = Invoke-VMScriptPlus @sInvP [String]$UUIDwin = $UUIDreturn.ScriptOutput Convert-UUID -UUIDwin $UUIDwin Get-VM -Name "Veeam-03" | Get-VMID | select UUID • Match Guest OS to vSphere VM
  • 16. Q&A