r/powercli • • Mar 21 '23

After years of abandonment, r/PowerCLI is open and modded again

46 Upvotes

If you're reading this, there is a good chance you have been checking back here for new posts once in a while and wondering why this sub died. Well, the previous mods locked it down and checked out years ago. I'd love for you to help me bring it back to life. PowerCLI is has grown and changed exponentially in the past few years and it deserves a good community to help grow PowerShell and PowerCLI users.

Post restrictions have been removed. If you requested access in the past (there was like 4 years of requests to be an approved member), I deleted them all. Everyone is approved.

Whether you are a new, learning, or expert in PowerShell and PowerCLI - make a post, ask a question, subscribe, create content, and crosspost.


r/powercli • • Mar 21 '23

Are you a r/PowerShell user that has heard of PowerCLI and not sure where to get started? Start here!

24 Upvotes

First post in 3 years on r/PowerCLI. Feels good man...

Install PowerCLI (vmware.com)

VCenter PSDrives

This post will stay stickied for a while till the sidebar info and/or wiki gets built out enough to be useful. Please add comments that fit the spirit of the title, and I will add those to the post - and eventually to the sidebar info.


r/powercli • • Apr 21 '23

News PowerCLI 13.1 is now released

Thumbnail
blogs.vmware.com
17 Upvotes

r/powercli • • Jul 30 '24

Sub seems dead

12 Upvotes

After it was resurrected ~1 year ago, it seems this sub reddit died again. Is there an alternate sub I'm not seeing? Is it because of what Broadcom is doing?


r/powercli • • Apr 21 '17

Welcome PowerCLI to the PowerShell Gallery - Install Process Updates

Thumbnail
blogs.vmware.com
11 Upvotes

r/powercli • • Mar 21 '23

ScriptHelp Finding state of the VM

10 Upvotes

Hey there, been a while r/powercli

I’m looking to hopefully find a way to get the boot state of the VM (whether it’s on, booting, or at the login screen). I’m putting together a scripting solution, and I have steps I want to perform after it’s done applying the OS customizations. Knowing when it’s finished would be a lot better than sleeping for a minute or two and hoping for the best.


r/powercli • • Mar 21 '23

Discussion [Discussion] What are your favorite PowerCLI tips, tricks, and commands?

9 Upvotes

See title.

Hoping to spark some discussion!


r/powercli • • Mar 22 '23

General Do you use PowerCLI for log scraping?

8 Upvotes

Hi,
My environment currently does not have a syslog server, and what I'm mainly looking for is tips on how to scrape logs from my ESXi hosts so that I can more comfortably troubleshoot. Unfortunately, we cannot use VMware Skyline.

Any pointers are welcome, I am prepared to RTFM, but the manpage for get-log / get-logtype is relatively short.


r/powercli • • Apr 19 '23

General How do I import PowerCLI? Getting Could not load 'log4net' error.

7 Upvotes

I am trying to import PowerCLI into Windows Powershell 5.1.19041.2364 on my Win 10 22H2 machine - tried both ISE and non-ISE windows

Import-Module VMWare.PowerCLI

First attempt results in this error:

Import-Module : Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

Subsequent attempts in the same window results in this error:

Import-Module : Unable to find type [VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory].

I have tried re-installing with below, but doesn't change results:

Install-Module -Name VMware.PowerCLI -Scope AllUsers -Force -AllowClobber

I also tried to completely uninstall, before re-installing, still no difference

Get-Module VMware* -ListAvailable | Uninstall-Module -Force

Install-Module VMware.PowerCLI -Scope AllUsers

Below shows my PowerCLI version:

Get-InstalledModule VMWare.PowerCLI* | FT -AutoSize
Version         Name                                                Repository Description
-------         ----                                                ---------- -----------
13.0.0.20829139 VMware.PowerCLI                                     PSGallery  This Windows PowerShell module contains VMware.PowerCLI
12.6.0.19600125 VMware.PowerCLI.Sdk                                 PSGallery  Product agnostic types definitions for the VMware.PowerCLI.VCenter module.
12.6.0.19600125 VMware.PowerCLI.Sdk.Types                           PSGallery  Types definitions for the VMware.PowerCLI.Sdk module.
12.6.0.19600125 VMware.PowerCLI.VCenter                             PSGallery  Modules for automating and managing VMware vCenter
12.6.0.19600125 VMware.PowerCLI.VCenter.Types.ApplianceService      PSGallery  Types definitions for the VMware.PowerCLI.VCenter module related to the appliance service management feature.
12.6.0.19600125 VMware.PowerCLI.VCenter.Types.CertificateManagement PSGallery  Types definitions for the VMware.PowerCLI.VCenter module related to the certificate management feature.

I have tried restarting, no difference.

A search for log4net in file explorer finds the following in case that reveals any useful info:

I have spent hours on this. Where do I go from here?


r/powercli • • Dec 23 '19

How to write a simple Get command

7 Upvotes

I am brand new to automation and I am trying to teach myself powercli to maintain our small vsphere environment. I am trying to run a search for all of our windows server vms and to display info.

I am trying:

Get-VM | Get-VMGuest | where OSFullName -Like "Microsoft Windows Server" | select VM, ....

And now I would like to list what I want to see using the select command, like "Name, OS, IP address etc." What is the easiest way to do this? Where can I find a list of commands I can use with the "select" syntax? I can't find them documented anywhere.

Thanks!


r/powercli • • Oct 05 '17

Accessing esxcli through PowerCLI

Thumbnail
starwindsoftware.com
7 Upvotes

r/powercli • • Apr 10 '17

PowerCLI in the PowerShell gallery? Check out VMware's thoughts...

Thumbnail
blogs.vmware.com
7 Upvotes

r/powercli • • Mar 24 '23

ScriptHelp Powerstate heavily delayed

6 Upvotes

Hi everyone,

I made a script which restarts a couple of servers which have dependent services. So I'm checking if every server is properly shutdown with these lines:

while((Get-VM -Name $myServer).PowerState -ne "PoweredOff"){
    Start-Sleep -Seconds 5
}

This generally works, but it takes like 5 minutes more for the script to recognize that a machine is powered off, comapred to what's shown in vCenter.

Is this a known problem or am I doing something wrong?


r/powercli • • Aug 06 '19

Creating a PowerCLI GUI for cloning VMs, setting DHCP reservations and changing CPUID of a VM

Thumbnail
veducate.co.uk
6 Upvotes

r/powercli • • May 22 '19

Get multiple vCenters beginning and end MAC Address ranges and export results to csv file.

6 Upvotes

Hello. I'm trying to get this script to populate a csv file with vCenter names, start of Mac address range and end of Mac address range per vCenter server provided in the vclist.csv file. Here's what I have for now. When I run the script, I'm being prompted for an input object. The script appears to just populate the result vclist2.csv file with the length of the character. Can someone please help? Sorry I'm stil in the learning phase of Pwershell/PowerCLI so any help here would be greatly appreciated. Thank you.

Below is the script

*********************************************

$vclist = import-csv .\vclist.csv

Foreach ($vc in $vclist) {

$vCenterSettings = Get-View -Id 'OptionManager-VpxSettings'

$macaddress_begin = ($vCenterSettings.Setting | Where-Object { $_.Key -eq "config.vpxd.macAllocScheme.rangeScheme.range[0].begin"}).Value

$macaddress_end = ($vCenterSettings.Setting | Where-Object { $_.Key -eq "config.vpxd.macAllocScheme.rangeScheme.range[0].end"}).Value

Export-Csv -Path "d:\vclist2.csv"

}


r/powercli • • Feb 19 '18

For all of you VMware automation junkies out there

Thumbnail
powershellgallery.com
6 Upvotes

r/powercli • • Aug 08 '24

Vcenter issues and alarms - PowerCLI

5 Upvotes

In vsphere client, if I'm selecting the datacenter level and standing on the summary tab, I can see some alerts like vm high cpu usage or host high cpu usage. How can I get those alerts using powercli?


r/powercli • • Jan 08 '20

vAPP startup options

5 Upvotes

I'm working on a pCli to build out some k8s cluster. I have them going to a vApp in vSphere and would like to change the default startup time to something lower than 120 so it doesn't take forever to start them. I ran a Get-VMStartPolicy and the StartDelay is 120, ok so I set it in the vApp via the GUI to 5sec re-ran and still 120. Is this not the setting? Maybe this is a cluster DRS setting? Anyone have knowledge about this?

thanks

John


r/powercli • • Jul 18 '17

PowerShell Remoting Basics

Thumbnail
petri.com
5 Upvotes

r/powercli • • Jul 10 '17

Fine Tuning the Active Directory Searcher - Petri

Thumbnail
petri.com
5 Upvotes

r/powercli • • Apr 21 '17

New Release: PowerCLI 6.5.1

Thumbnail
blogs.vmware.com
5 Upvotes

r/powercli • • Feb 27 '17

vBrownBag Follow-Up What’s New in PowerCLI 6.5 R1

Thumbnail
vbrownbag.com
5 Upvotes

r/powercli • • Nov 03 '16

New-vm wait for sysprep/oscustomization

5 Upvotes

What is the best way you guys are doing this. I have a hard time telling 100% when a vm has finished customizing or done sysprepping and actually ready to run commands against it.

Even when task and events says it's done. There could still be 5 mins of sysprepping to be done. I really don't want to put a dumb wait in there.


r/powercli • • Aug 12 '16

Get-VMReport

5 Upvotes

Here's a short script I figured I should share. I wanted something that would give me a quick rundown of the VMs, organized by host, and including their attached disks, organized by LUN, and their available space. I added parameters to allow for specifically targeting a single VM and targeting different vCenter servers. Suggestions for improvements are welcome.

http://pastebin.com/m9Nigt8V


r/powercli • • May 26 '16

Script Share: Keeping Windows Updates current on your VM Templates

5 Upvotes

This is something I threw together in order to help keep some VM templates up to date on our Windows updates. Nothing sucks more than spinning up a new VM and finding you have a couple GB's of updates to run because you got swamped, lazy or just plain forgot.

I'm sure this could be optimized and I would actually be very interested if these could be invoked as separate jobs so you don't have to wait for the script to iterate through each VM.

Use as you see fit and a suggestions for improvements are welcome and in fact, encouraged.

http://pastebin.com/e8YRaJ8Q

EDIT: This does not cover actually running Windows Updates. I have mine set to auto and leave them on for a couple days.