Questions tagged [powercli]

VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell

VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell, and provides more than 600 cmdlets for managing and automating vSphere, vCloud, vRealize Operations Manager, vSAN, NSX-T, VMware Cloud on AWS, and VMware Horizon environments.

Resource for Downloads and Documentation and Reference

79 questions
3
votes
1 answer

Get Used rather than Provisioned space in PowerCLI

I'm trying to run a capacity report, and when I run the Get-HardDisk cmdlet in PowerCLI, the value it returns for CapacityKB is the Provisioned space. For example, let's say I've thin provisioned a 200GB disk, which is currently using say 30GB, it…
Matt
  • 1,883
  • 5
  • 26
  • 39
3
votes
4 answers

How to prevent taking snapshots after threshold in VMware ESXi?

We have given our users privilege to take snapshots. But now it is uncontrollable and people started taking meaningless snapshots and never deleting it. Due to this we are facing performance issue, Disk space overloaded issue and etc. I would like…
Samselvaprabu
  • 1,311
  • 5
  • 13
  • 26
3
votes
2 answers

PowerCLI - add shared hard disk to vm, using existing scsi controller

I would like to add a shared virtual disk to a second VM which is already attached to a first VM. They will have shared access to the disk, via SCSI controllers set to virtual bus sharing. This works fine via the vCenter GUI, but I'd like to do it…
sjw
  • 374
  • 1
  • 4
  • 9
3
votes
2 answers

Encrypt powershell Credentials (creds) files

I have started to play around with PowerCLI and therefore created a credentials file to use when I connect to vCenter. The purpose for this will be to run scheduled tasks, such as running the vCheck daily script. I will probably setup a service…
Chadddada
  • 1,670
  • 1
  • 19
  • 26
2
votes
1 answer

ESXi 6.7 Instant Clone without vCenter

Is it possible to create an Instant Clone of a Virtual Machine in VMware ESXi 6.7 Standard without a vCenter Server present using PowerCLI?
Adam Chance
  • 121
  • 3
2
votes
2 answers

vSphere PowerCLI storage vMotion

How do I svMotion a single disk in PowerCLI 5.5? Trying Set-HardDisk gives the following warning: WARNING: Parameter 'Datastore' is obsolete. 'Datastore' parameter is obsolete. To move hard disk to another datastore and change it's storage format,…
Marki
  • 2,795
  • 3
  • 27
  • 45
2
votes
1 answer

ESXi 5.5 hosts have multiple HostDateTimeSystem entries

I've been trying to do an audit of time skews on some of my hosts recently. Using PowerCLI I found a few scripts that reference the ConfigManager.DateTimeSystem to get the ESXi Host datetime. However A few hosts seem to have 2 time entries/2…
user230027
  • 21
  • 1
2
votes
2 answers

vmware thin disk usage powercli

I want to ask a question about thin provisioning. get-vm commandlet can easly give us real space used by a vm totally. Assume that you have a virtual machine which has more than one thin disk. If we want to get more detail so as to calculate each…
2
votes
2 answers

Delete all snapshots over 30 days old

I'm currently using VMware 5.1 and looking for a method to keep snapshots that users create from becoming too old. Is there any tool inside of VMware that allows you to manage snapshots (or possibly a method to script this)? Ideally I'd like to…
Valrok
  • 330
  • 3
  • 11
2
votes
3 answers

'exit status' of a powershell pipeline

How do I check for the success/failure of a pipeline from within the same executing script? Get-VM -Name Machine | Get-Snapshot | Where {$_.Created -lt (Get-Date).AddDays(-1)} | Remove-Snapshot -Confirm:$false I don't need anything more than the…
Yolo Perdiem
  • 606
  • 1
  • 5
  • 14
2
votes
1 answer

VMWare 5.1 Datastore in use when trying to unmount?

When trying to unmount a datastore from one of my 4 ESXi hosts, I receive a message that it's in use. The full error stack I see is: Call "HostDatastoreSystem.RemoveDatastore" for object "datastoreSystem-57" on vCenter Server…
SeanKilleen
  • 1,073
  • 8
  • 25
  • 38
2
votes
2 answers

Export a list of VMs without a specific tag with PowerCLI

I'm trying to export a CSV file that has a list of all VM's in a cluster that don't have a specific tag that I'm using for rightsizing. However, the CSV isn't populating with anything other than this: ÿþ Get-Module -Name VMware* -ListAvailable |…
1
vote
1 answer

Get-VM command with -Location parameter returns one result then error

i'm writing a powerCLI script and i'm facing a strange behaviour. I use connect-VIserver with administrator@vsphere.local account to connect to my VCSA 6.7 U2 server. If i use Get-VM cmdlet without any parameter it returns all VMs without problems.…
Paolo RSE
  • 21
  • 2
1
vote
0 answers

get FULL hardware configuration of a VM from powercli

I want to export the complete hardware configuration of a vm to the console via PowerCLI. Get-VM seems to only have limited information based on a Get-VM xxx | Get-Member check. In vCenter, if you right click on a vm and select "Edit Settings" you…
1
vote
1 answer

VM restarted by HA after powered off from PowerCLI

I am using PowerCLI to "PowerOff" VMs when there is a certain event detected. When this even happens, the only thing we can do is to power off the VM and power it on again. I use Stop-VM -VM xxxx -Kill -Confirm:$false to power off the VM but I…
Root Loop
  • 892
  • 4
  • 22
  • 44