Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [powercli]

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

Filter by
Sorted by
Tagged with
0 votes
0 answers
7 views

set-vm(guest customisation) : The operation for the entity "x" failed with the following message: "A specified parameter was not correct: hostname

(powercli newbie here) I am using guest customisationscript that needs hostname when creating vm. Using that in powercli fails $New_vm=get-vm "ies-jtmpl-t005" $OSSpecs = Get-...
user avatar
  • 141
2 votes
2 answers
541 views

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: ...
user avatar
0 votes
1 answer
968 views

Powercli create local user and assign permission At VC level

I need a powercli script to automate some task in VC , I have found below script but here I can assign AD group permission to folder level. but I want to assign permission at VC level. is there any ...
user avatar
  • 317
1 vote
0 answers
38 views

Unable to Read VSAN Datstore Items using powercli, it is returning UUIDs instead of Name

I'm trying to upload an ISO to VSAN datastore using Powercli. I want to check if there is a folder named ISO, if not, create and upload to that folder. For other DS Types (VMFS), I have not faced any ...
user avatar
0 votes
1 answer
805 views

Powershell module import not persisting in docker container image

I installed powershell in the php debian docker image and now I am installing PowerCLI module in the docker image to access the vsphere info and display using laravel. The issue is with the PowerCLI ...
user avatar
  • 103
1 vote
0 answers
70 views

How can I get the current network in/out values of any NIC of a VMware ESXi host server?

I am aware that IF-MIB provides input and output values for any NIC of a target device via SNMP. Recently a sysadmin compared the values of a specific NIC of an ESXi host server in our VCenter with ...
user avatar
1 vote
0 answers
59 views

Getting the name of the Snapshot from a specific VM?

How can I get the name of the snapshot that the particular machine is using? I have tried: Get-VM -Name vdix-test-01 | Get-Snapshot but it returns blank.. I am trying to retrieve the name of the ...
user avatar
1 vote
1 answer
101 views

Automate VMWare Config Backups

I am looking for a way to automate nightly backups of my VMWare ESXi Configs for disaster recovery. Ideally the script would connect to my vCenter server, poll it for hosts, and then backup the ...
user avatar
1 vote
1 answer
420 views

Add Network Adapter to VM in vCloud Director using PowerCLI

I am using the PowerCLI version 12 and have a VM which currently has no network adapter. There is the Cmdlet Get-CINetworkAdapter but that returns null (because there is no adapter) And there is Set-...
user avatar
0 votes
1 answer
152 views

How to Move Multiple VM's to Different datastore

I have tried and search multiple way to migrate VM's to different data store $existingds = Get-Content dummy path $newds = Get-Content dummypath Get-Datastore $existingds | Get-VM | Move-VM -...
user avatar
  • 1
1 vote
1 answer
338 views

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 ...
user avatar
0 votes
1 answer
2k views

Script to storage vmotion from one datastore to another

Ive done some searching and could not find what I'm looking for so I am making a post: I would like to storage vMotion from one datastore to another, 10 at a time, and output the vm's migrated to a ...
user avatar
  • 3
1 vote
0 answers
145 views

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 ...
user avatar
0 votes
1 answer
961 views

PowerCLI - Get Active FC Path WWN of all datastores

I need to turn off one of the FC switch for maintenance. To turn off the switch smoothly, I want to set the manual path selection mode and switch all datastores to the second switch. I have a lot of ...
user avatar
0 votes
1 answer
2k views

VMware Power CLI: how to get custom attributes for a datastore

I am trying to get a custom attribute value for my datastore, but bumping into an issue with type incompatibility. Is there anything I am doing wrong below, and how to fix it? PowerCLI C:\> $ds = ...
user avatar
  • 359
2 votes
1 answer
523 views

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?
user avatar
0 votes
0 answers
262 views

Powershell / Powercli script Cronjob

I made a Powershell script which uses Powercli to create and delete snapshots on my two Esxi hosts, but for some reason the Cronjob isn't working. In the syslog I can see the following message: (...
user avatar
0 votes
1 answer
48 views

Utilize Measure PowerShell command to get vCenter VMs HW versions

I've never used PowerShell measure command, but found it pretty handy and it can make my code shorter. For now I'm looking how to get a report about VMs count and HW version they run on. Using latest ...
user avatar
0 votes
1 answer
496 views

PowerCLI Get-EsxCli Type Conversion Error

On three different servers, and one desktop, using PowerCLI 10, I am unable to call any of the EsxCli invocations, getting instead: > $esxcli = Get-EsxCli -VMHost "host.f.q.d.n" -Server (Connect-...
user avatar
1 vote
1 answer
539 views

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 -...
user avatar
  • 892
0 votes
0 answers
3k views

Powercli Build and install VM from ISO

I assume this would be easy. However i cannot get powercli latest to mount a cd with an iso and boot from the ISO to install the OS(windows). $NewVMParams = @{ 'VMHost' = 'MyESX1' 'Name' =...
user avatar
  • 229
0 votes
1 answer
2k views

Queue VMware Virtual Machine vMotion using powercli

I wrote this quick Powershell script where it queues vMotion of VMs and runs only 4 vMotion tasks at a time. I thought this might help someone, so you are free to modify the code as per your like. We ...
user avatar
  • 111
0 votes
1 answer
2k views

Get actual usage of VMDK on SAN

I have a script that retrieves details for all VMs in my vCenter Cluster. Essentially Get-VM | Get-Harddisk. I can also get the Provisioned Space and Used Space values, but these are only for the VM ...
user avatar
2 votes
2 answers
1k views

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 ...
user avatar
  • 2,795
1 vote
0 answers
908 views

How to run cmd from PowerCLI Invoke-VMScript starting with an open console

I'm trying to run a exe file in a remote machine from PowerCLI which is launching couple of cmd's. With this command: $executeCommand = "call D:\MyFile.exe Arg1 Arg2"; Invoke-VMScript -VM $vmName -...
user avatar
3 votes
2 answers
248 views

Rapid deployment of similar VMs

We're rolling out a new testbed in the office, and need to spin up ~30-40 Linux VMs (mostly RHEL 5/6, some SuSE). Running on VMware ESXi 5.5, we'd like to automate the process. There's a pre-made ...
user avatar
0 votes
1 answer
698 views

PowerCLI transfers a file but the copied file size is way too small. What is wrong?

I am using PowerCLI version 6 on a Windows server with 20 GB of free space. I am trying to use copy-datastoreitem with PowerCLI. It seems to work to transfer a .vmdk file from an ESXi datastore to ...
user avatar
  • 67
0 votes
1 answer
24 views

Does PowerCLI have PowerShell Profiles?

Powershell has profiles that you can use to load functions you've written when your shell loads up. Does PowerCLI have a similar functionality?
user avatar
  • 4,767
1 vote
0 answers
44 views

New-VM cmdlet stalls when create a new VM (works fine in vCenter)

Not sure were the issue is here. I can interactively create a VM in vCenter with exactly the same settings and it creates the VM like instantly. I just tried to do this with New-VM and it stalled at ...
user avatar
  • 3,969
1 vote
1 answer
1k views

How can I get the VMware view agent version of VMs with powercli?

How can I get the VMware View Agent version running on a VM with powercli or View Powercli?
user avatar
  • 3,969
1 vote
1 answer
491 views

powercli math with vmware - datastore property division arithmetic

basically, I get all 0's returned in the percentage1 column. I need help with what I believe is syntax or incorrect use of Round. Get-Cluster "my_cluster" | Get-VMHost | Get-Datastore | Select Name,@{...
user avatar
0 votes
2 answers
989 views

vCenter Thin Provisioned disk usage calculations

I'm managing a number of Thin-Provisioned VMs in vCenter 5.1.0. Each contains one virtual Harddisk. We run a pretty tight ship in terms of allocating storage, so the difference between 1 or 2 GBs is ...
user avatar
1 vote
0 answers
166 views

PowerCLI - Network nested ESXi

Is there a way to configure the management interface of a nested ESXi Guest over PowerCLI? I'm looking to automate the configuration of a nested ESXi VM for testing customer configurations / clusters....
user avatar
0 votes
1 answer
2k views

How can I get VMHost's operating system and serivce pack info using Get-VMHost

I am trying to get the VMHost operating system info , but I can not find the required scripts. I tired this :- Get-VMHost which return a lot of info about the VMHost,, but the operating system info ...
user avatar
  • 339
1 vote
1 answer
251 views

unable to get the IP,Mac, and other network info using (Get-VMHost).NetworkInfo

I am using powerCLI verion 5.5, and I wrote the following script:- Get-VMHost |Export-Csv -Path c:\test.csv -NoTypeInformation –UseCulture I got info for the vmhost such as used memory, build, state ...
user avatar
  • 339
1 vote
1 answer
350 views

Get-VMHost does not show the server Networkinfo and number of processes

I run the following powercli 5.5 command , to get info about a host vm :- Get-VMHost |Export-Csv -Path c:\VM.csv -NoTypeInformation –UseCulture and I got these info :- State ConnectionState ...
user avatar
  • 339
0 votes
1 answer
3k views

Unable to connect to server using its name "Connect-VIServer "

I wrote the following PowerCLI command to connect to a server by its name :- Connect-VIServer -Server "t***.v****ces.intra" -User root -Password "*****" but I got the following error:- Connect-...
user avatar
  • 339
0 votes
1 answer
995 views

Connect-VIServer will always propt a dialog to enter username & password

I rung the following command inside powercli 5.5:- PowerCLI C:\> Connect-VIServer -Server 172.16.20.101 -User root -Password **** but I got a dialog to enter username and password although I am ...
user avatar
  • 339
0 votes
1 answer
131 views

Using PowerCLI Versus using asp.net WMI to scan and retrive informaion about ESX hosts

I want to scan and view information about ESX hosts which have "ESXi 5.0 Update 1" as their OS inside my asp.net web application. mainly to be able to retrieve the ESX specification and all the vms ...
user avatar
  • 339
1 vote
1 answer
3k views

VMware Cloning with POWERCLI with nested folder

I'm trying to clone some Virtual Machines using POWERCLI, but when I set the target location I'll have the error "Could not find Folder with name" ... My folder estructure is like: DC1\destfolder DC2\...
user avatar
  • 83
4 votes
1 answer
441 views

Can you list a Datastore Cluster's sDRS Schedule via PowerCLI?

We have a lot of datastore clusters, most if not all are supposed to have sDRS schedules applied to stop them moving VMs at busy periods. Obviously we could trawl through them manually to check if ...
user avatar
  • 99.6k
-1 votes
1 answer
5k views

Powercli Script to measure the count of Host and its Vm's in a each clusters

I am trying create a on-liner script which gives an outputs of Hosts and vm's counts in a vcenter cluster like as below. Cluster: VMHost ...
user avatar
  • 109
1 vote
0 answers
290 views

Vm counts by folders

I have created a script which collected the VM counts for the selective folders in each Vcenter, This scripts seems working fine but it's not collecting output to the CSV. $output = @() Get-Content -...
user avatar
  • 109
1 vote
1 answer
594 views

Trouble with embedding html email with PowerCLI/Powershell for gmail

I am new to Powershell, I am a junior admin for a VMware environment. I am trying to automate a weekly report for snapshots in PowerCli. I am making the script in Powershell. I have made a simple css,...
user avatar
3 votes
1 answer
1k views

PowerCLI automation set-cddrive error

When attempting to change ISOs on a powered on guest instance, set-cddrive is returning an error but completing the command. A couple different commands produce the same result: $theVM | Get-CDDrive ...
user avatar
  • 951
3 votes
3 answers
7k views

PowerCLI Move-VM Returns failure but vm still moves

I have a script that is moving VM's from one datastore to another. I have other logic to protect the Storage backend and fabric from over subscription and to wait to submit new requests at specific ...
user avatar
  • 782
4 votes
4 answers
16k views

How do I open the VMware Remote Console (application) from the PowerCLI?

A recent update to ESXi in our environment added a feature, "Open with VMRC". This works outside the browser, and as the method of accessing the console that functions inside the browser hasn't ...
user avatar
  • 217
2 votes
1 answer
493 views

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. ...
user avatar
9 votes
3 answers
8k views

ESXcli command timeout at 30 minutes

I am working on a powercli script to loop through each datastore in our environment and reclaim space on the thin provisioned LUNs. All LUNs in the environment are Dell Equal Logic. vCenter ...
user avatar
  • 198
0 votes
1 answer
1k views

Reload VIAccounts list with PowerCli to select a newly created group

I'm using a script that creates groups in Active Directory, and links them to my vCenter server using New-VIPermission. The trick is that it doesn't find the groups created unless I restart the script ...
user avatar
  • 63