Questions tagged [powercli]

VMware vSphere PowerCLI is a set of Windows PowerShell snap-ins that provide cmdlets to automate vSphere and vCloud virtual environments.

VMware vSphere PowerCLI contains snap-ins of cmdlets based on Microsoft PowerShell for automating vSphere and vCloud administration. It provides C# and PowerShell interfaces to VMware vSphere and vCloud APIs.

(VMware vSphere PowerCLI Cmdlets Reference)

PowerCLI provides hundreds of cmdlets "for managing, monitoring, automating, and handling lifecycle operations for vSphere and vCloud Director components" (VMware vSphere PowerCLI User's Guide).

References:

540 questions
2
votes
2 answers

How can I get a VirtualMachine reference using VMware Java vSphere SDK?

I am familiar with using the VMware VIM API in C# using the VMware.Vim.dll provided in the PowerCLI. Now I want to be able to program with this API using Java, but I can't find an equivalent to it. The com.vmware.vim.jar in the vSphere SDK doesn't…
lehn0058
  • 19,977
  • 15
  • 69
  • 109
2
votes
1 answer

Verifying system partition alignment via scripting

I'm trying to verify that the file system partitions within each of the servers I'm working on are aligned correctly. I've got the following script that when I've tried running will either claim that all virtual servers are aligned or not aligned…
Valrok
  • 1,514
  • 7
  • 30
  • 49
2
votes
1 answer

VMware Powercli Get-Snapshot

Using VMWare PowerCLI, how can I set a snapshot of a VM without getting the confirmation prompt? Get-Snapshot -VM VM -Name 'snapshotname'
l0sts0ck
  • 373
  • 1
  • 4
  • 10
2
votes
4 answers

VMware PowerCLI Variables in ScriptText

Hello I'm having a bit of problem with the Invoke-VMScript cmdlet I have made a script that creates a virtual Windows 7 machine and then some powershell script executes on the machine for example renaming the computer to the correct name. But if I…
TelefoneN
  • 35
  • 2
  • 7
2
votes
1 answer

Get ISO's mounted and change device type to client

I'm trying to find a way with PowerCLI to get a list of ISO's that are mounted in VM's and change the device type to "client device." Originally I thought that using the get-datastore would work to find the ISO's, however I was struggling to find…
Valrok
  • 1,514
  • 7
  • 30
  • 49
2
votes
1 answer

Loop through a collection of objects n at a time

I am a self-taught, newbie programmer, and I feel like this is a really basic question, the kind I'd be able to answer if I had actually studied computer science :P In my searching of the intertrons and StackOverflow I haven't been able to find the…
Formica
  • 389
  • 2
  • 8
  • 15
2
votes
1 answer

Why executing the powershell script first time in a session takes much time?

I am loading Powercli snapin in my script. If i execute a script first time in a session it takes more time. When i am executing another script which uses the same snapin ,it takes less time.[I measured the performance using Measure-Command…
Samselvaprabu
  • 16,830
  • 32
  • 144
  • 230
1
vote
1 answer

writing a message to a RemoteSession VMWare

I would like to write a message to a client who is connected via a remoteSession. I would like to use the Powershell Snap-In View PowerCli. Is there a possibility? My main target is: When I send a session logOff my Client should be informed in form…
andreaspfr
  • 2,298
  • 5
  • 42
  • 51
1
vote
1 answer

Need Get-VM progress

We have a very large environment therefore it takes around 5 mins to collect all of the VMs and store them into a variable. I need a way to display progress until this collection is complete. I figured a do until loop would work, however I cant…
jrob24
  • 454
  • 1
  • 7
  • 18
1
vote
1 answer

ISO not booting using powwershell

I am having the below codes where first I am mounting the ISO file to the CD drive of the VM and next I am changing the BootOrder of the VM Mounting to CDDrive $CloneVM = Get-VM -Name "999_SW999OSTest_Clone" $IsoPath =…
1
vote
0 answers

Setting Network via powershell not working as expected

CSV I am trying to pull info from a CSV and use invoke-vmscript to change ip addresses on a specific network adapter (filtered by interface index). But am receiving the following error New-NetIPAddress : Cannot bind argument to parameter…
1
vote
0 answers

plaintext credentials are showing in window event logs when connected to vcenter using powershell

@powershell @vcenter I have connected to vcenter with encrypted password as below. But still my plaintext password is getting logged in event logs. How can I make my credentials hide in log. $SecurePassword = ConvertTo-SecureString…
Kumar
  • 11
  • 2
1
vote
0 answers

PWSH / PowerCLI | Order the output of a ForEachObject -Parallel

I currently have a script that executes in parallel the space reclaim of a VM disks, it basically generates the reclaim-script.sh for each disk: foreach ($vm in $VMs) { # Gets the disks of the VMs $Disks = (Get-VM -Name…
1
vote
1 answer

Can powercli tell me what the VM Name is when listing network adapters for vms?

I want to get a list of VMs with a given vlan name configured so that when I am rolling back a vlan, with ACI I am certain that it is gone. This script works, I connect to the vcenter with powercli and pass in a vlan_name: foreach ($vm in Get-VM){ …
Peter Turner
  • 11,199
  • 10
  • 68
  • 109
1
vote
1 answer

Powershell match similar entries in an array

I've written myself a script to check for vm-folders in vmware vcenter that dont match the corresponding vmname. There are a few automatically deployed VMs which i need to exclude from this check. Those VMs are always similarly named, but with an…
Hannes W.
  • 13
  • 2