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 VMware PowerCLI: Performance Tweaks and Special Features

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 VMware PowerCLI: Performance Tweaks and Special Features (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

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 

Recently uploaded (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
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
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 

VMware PowerCLI: Performance Tweaks and Special Features

  • 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