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
40
votes
1 answer

Which VMware API should I use?

I'm trying to write a fairly simple application in C# (or at least, I think it should be simple) that polls a vCenter for all of its ESX servers, then each ESX server for all of its VMs. It will collect some simple, real-time statistics and plop 'em…
The Maniac
  • 2,628
  • 3
  • 19
  • 29
21
votes
3 answers

Need help on Powershell Copy-Item from network drives

I am trying to use Copy-Item from remote machine to another remote machine with the command: Copy-Item -Path "\\machine1\abc\123\log 1.zip" -Destination "\\machine2\\c$\Logs\" I am constantly getting Error "Cannot find Path "\\machine1\abc\123\log…
Geeth
  • 321
  • 1
  • 2
  • 4
10
votes
4 answers

Powershell: Permanently Modify Path, "Requested registry access is not allowed."

I need to permanently add a scripts folder to my PowerShell path (not just a particular session). I am running the following code: [System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";C:\scripts", "Machine") The error is as…
corneria
  • 608
  • 3
  • 11
  • 24
10
votes
1 answer

How do I run disconnect-viserver with no prompt in PowerCLI

How can I disable the prompt when using the following cmdlet to disconnect from a server in PowerCLI? The help file shows a -Confirm option, which I don't use, so I'm inferring from this that without it, there should be NO prompt, but I still get…
Chris F
  • 14,337
  • 30
  • 94
  • 192
10
votes
1 answer

How to recursively enumerate through properties of object?

I've started rewriting my VMware daily report to use Get-View, rather than the related PowerCLI commands wherever possible, for performance reasons. One minor inconvenience with this is that the view objects returned often have many properties, many…
KevinD
  • 3,023
  • 2
  • 22
  • 26
8
votes
6 answers

PowerCLI - Finding Virtual Machine via VM IP

I am trying to locate specific VM's based from IP addresses in PowerCLI. I found this script online Grabbing VM ipaddress via PowerCLI The intial question explaines the issues I was having, and the answer looks to resolve such issues, however when…
StackUser_py
  • 173
  • 1
  • 1
  • 6
8
votes
2 answers

How to search array of objects contains an item in another array?

I have two arrays. An array of objects containing Virtual Machine Information called $vms one of the attributes called Name. Here's the type: PowerCLI > $vms.GetType() IsPublic IsSerial Name BaseType --------…
Mark Allison
  • 6,838
  • 33
  • 102
  • 151
7
votes
4 answers

Inner Join in PowerShell (without SQL)

How do we make Inner-Join or something a Cross-Join in PowerShell or PowerCLI? Even though im new to PowerCLI/PowerShell , I do have a basic grasp on them, yet have practically spent 2 days trying to figure this, going through numerous…
AdilZ
  • 1,107
  • 6
  • 27
  • 44
7
votes
5 answers

PowerShell/CLI: "Foreach" loop with multiple arrays

I have a PowerCLI script that powers off a VM, changes its memory and cpu, and then powers it back on. I've adapted the script to utilize variables. This all works perfectly. I'm now trying to modify the script to utilize arrays, in order to cycle…
6
votes
2 answers

List VMs and their cluster

I'd like to be connected to multiple VIservers and list all the VMs + their respective clusters. Is this possible? I've gotten as far as Get-VM | Select Name,VMHost. What property in place of VMHost would list the cluster?
rafvasq
  • 1,512
  • 3
  • 18
  • 48
6
votes
2 answers

Passing an array to Get-Job

I am having trouble getting an array passed to a scriptblock in Start-Job. Can you tell me what I might be doing wrong? $bounceBlock = { param( [string[]]$list, [System.Management.Automation.PSCredential]$cred ) Add-PSSnapin…
Acerbity
  • 417
  • 1
  • 11
  • 29
6
votes
1 answer

Round a number in PowerShell one-liner

I'm using VMWare's PowerCLI to run this command to output an inventory of sorts from vCenter. Get-VM | Select-Object Name,MemoryGB,NumCpu,UsedSpaceGB,@{n="TotalHDSizeGB"; e={(Get-HardDisk -VM $_ |Measure-Object -Sum CapacityGB).Sum}},@n="Network";…
Josiah
  • 2,666
  • 5
  • 30
  • 40
5
votes
4 answers

Running a PS1 script using a batch file (.bat)

Currently the following is my path for launching the VMware vSphere PowerCLI command prompt. I wish to run my sample.ps1 script automatically using a batch file. How can I incoporate sample.ps1 into this path and create a batch…
dwyane
  • 127
  • 2
  • 4
  • 8
5
votes
1 answer

Connect-VIServer doesn't connect due to invalid certificate disregarding PowerCLI's configuration

As the title suggests, I'm trying to login to a VMWare vSphere server using PowerCLI. Even though I ran Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -Confirm:$false -Scope AllUsers, when I try to connect to the server this is what I'm…
Shay Nehmad
  • 1,103
  • 1
  • 12
  • 25
5
votes
3 answers

how to set a timeout when executing Powershell & Powercli commands inside asp.net mvc

I am working on an asp.net mvc web application, and i have the following code which define a loop over a list of servers and execute PowerCli commands inside my asp.net mvc for each server:- //Start Loop var shell = PowerShell.Create(); var…
John John
  • 1
  • 72
  • 238
  • 501
1
2 3
35 36