Showing posts with label PowerCLI. Show all posts
Showing posts with label PowerCLI. Show all posts

January 26, 2022

Basic VmWare DataStore Stats

Get Basic VMWare DataStore Statistics via PowerShell PowerCLI

Big thanks to LucD, and this post which is essentially the entire solution: https://communities.vmware.com/t5/VMware-PowerCLI-Discussions/PowerCLI-script-to-get-DatastoreCluster-Datastores-and-the-size/td-p/1301104

Problem: I need stats on datastores. Specifically, i need to find which DataStores are over-provisioned compared to the VM’s assigned to it.

Solution:

The script will output to .CSV file sorted by ProvisionedGB/CapacityGB percentage.

As such, you may see which datastore are heavily over-provisioned (in the sense of datastore larger than necessary).
Of course, you may also sort my other columns as needed.




Please consider crypto tipping:
  

January 29, 2020

PowerCLI enable CBT

PowerCLI enable CBT on VM’s where CBT is disabled


Problem: Some VM’s have CBT disabled.

Warning: Maybe CBT should not be enabled in your environment. There are pre-requisites and if unpatched hosts, potential bugs with CBT. Please be diligent in researching CBT (Change Block Tracking) first.

Solution: (note: bypasses any VM's with existing snapshots)



~~~
As always, good luck.
Please consider crypto tipping:
  

April 05, 2018

Installing PowerCLI 10 in Debian 9

Installing PowerCLI 10 in Debian 9
 

The PowerCLI compatibility matrix states PowerShell 6.0.1 is supported. 6.0.2 and 6.1.0-Preview is not. (reference)

Firstly, install PowerShell [almost] as per documentation: (reference) or (reference)
sudo apt remove --purge powershell
sudo apt install libc6 libgcc1 libgssapi-krb5-2 liblttng-ust0 libstdc++6 libcurl3 libunwind8 libuuid1 zlib1g libssl1.0.2 libicu57 libssl1.0.0 libssl1.0.2 libssl1.1 libicu52 libicu57 curl gnupg apt-transport-https
curl https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-debian-stretch-prod stretch main" > /etc/apt/sources.list.d/microsoft.list'
sudo apt update
sudo apt install -y powershell=6.0.1-1.debian.9
sudo apt-mark hold powershell        #Pin this version... 'unhold' for non-recommended versions
pwsh

If you get a Segmentation fault you must sudo apt remove --purge libssl1.0.0!

Install PowerCLI inside PowerShell: (reference)
Install-Module -Name VMware.PowerCLI -Scope CurrentUser
Set-PowerCLIConfiguration -InvalidCertificateAction Ignore   #Accept self-signed certificates
You may later update with
Update-Module VMware.PowerCLI
Update-Help

If you want a scope of AllUsers, then you will have to install with sudo pwsh and perform subsequent update with sudo pwsh as well.

~~~
Good Luck!
Please consider crypto tipping:
  

January 29, 2018

trojan:powershell/peasecto.A powercli false positive vmware powercli



Problem:
Trojan:Powershell/Peasecto.A - VMWare PowerCLI False Positive

Available Resources:
1) https://blogs.vmware.com/PowerCLI/2018/01/windows-defender-reports-false-positive-powershell-modules.html
2) http://vmpro.at/windows-defender-reports-false-positive-for-powershell-modules/
3) https://social.technet.microsoft.com/Forums/en-US/40fa56dd-b73f-456a-9d97-cdb4500bc7ed/latest-updates-indicated-peasectoa-infection-?forum=WindowsDefenderATPPreview

This is what i did:
1) DISABLED WINDOWS DEFENDER REALTIME and CLOUD
2) Find-Module "VMWare.*" | Install-Module -AllowClobber -Verbose -Scope AllUsers -Force
3) Find-Module "VMWare.*" | Update-Module -Verbose -Confirm:$false

See https://steronius.blogspot.com/2017/04/vmware-powercli-651-now-easily.html for my original PowerCLI install post.

~~~
As always, good luck!








Coolest nerd tech ever:

 http://amzn.to/2BFbtM5



April 26, 2017

VMWare PowerCLI 6.5 now easily installed via PowerShellGet

PowerCLI


EDIT 2023: please see https://williamlam.com/2022/11/how-to-install-powercli-13-0-and-use-new-image-builder-auto-deploy-cmdlets-on-apple-silicon.html and https://www.virten.net/2022/12/how-to-install-powercli-13-with-python-3-7-on-windows-required-for-imagebuilder/ for extra help regarding python 3.7 dependency.

~~~~ OP ~~~~:

VMWare PowerCLI 6.5.x++ now easily installed via PowerShellGet! https://www.powershellgallery.com/packages/VMware.PowerCLI/

PS> Install-Module -Name VMware.PowerCLI -Confirm:$false -Scope AllUsers -AllowClobber -Force

That’s it! …However, You may also need to update occasionally:

PS> Find-Module "VMWare.*" | Update-Module -Verbose

Your scripts may begin with Import-Module VMware.VimAutomation.Core



See the vmware blog for more info, including installing under an administrator account for an “AllUsers” install (Very helpful for multi-user workstations): https://blogs.vmware.com/PowerCLI/2017/04/powercli-install-process-powershell-gallery.html i.e. [...] -Scope AllUsers

Separately, you may update all your powershell help files with Update-Help



If you wish to purge PowerCLI, do so with the following from a standard Powershell (not PowerCLI):

PS> (Get-Module VMware.PowerCLI -ListAvailable).RequiredModules | Uninstall-Module -Force
PS> Get-Module VMware.PowerCLI -ListAvailable | Uninstall-Module -Force


~~~
As Always, Good Luck!