Questions tagged [powercli]

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

Filter by
Sorted by
Tagged with
10 votes
4 answers
91k views

VMWare ESXi: how to add network drivers to installation?

Background / Problem I have two new servers (Dell R720 & Dell R520) that I plan to install ESXi onto. During the VMWare Hypervisor installation, I'm told that no network adapters exist. Upon ...
SeanKilleen's user avatar
  • 1,083
9 votes
3 answers
9k 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 ...
Lars's user avatar
  • 198
7 votes
3 answers
6k views

Setting a VM boot CD via PowerCLI

I have a sneaking suspicion that this may be a bug, but I'm definitely willing to entertain the possibility that I'm doing things wrong. I have a VMware virtual machine in $vm, and I'm trying to ...
Matt Simmons's user avatar
  • 20.5k
5 votes
1 answer
891 views

Checking partition alignment with PowerCLI

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 ...
Valrok's user avatar
  • 330
4 votes
4 answers
18k 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 ...
mojo's user avatar
  • 237
4 votes
3 answers
13k views

How can I get triggered alarms using PowerCLI?

In vSphere Client on a VM host in the Alarms tab there is a view of Triggered Alarms. How can I get those alarms using PowerCLI?
Andrew J. Brehm's user avatar
4 votes
4 answers
3k views

PowerCLI: Run commands in virtual-machine

We have several view-desktops and I need a script to be performed once on all desktops. Sadly, WMI is disabled. These desktop are all running Windows XP SP3 I thought I read about the possibility to ...
wullxz's user avatar
  • 1,073
4 votes
1 answer
1k views

Modifying the number of VCPUs in a VMware VM

In ESXi, what is the automation/script (I expect it would be using PowerCLI somehow) approach to modify the number of VCPUs in a VM? In context, when using our kickstarts, RHEL won't install the SMP ...
warren's user avatar
  • 18.6k
4 votes
1 answer
479 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 ...
Chopper3's user avatar
  • 102k
4 votes
1 answer
15k views

How do I shutdown the Host over ssh on ESXi 5 so it shuts down the guests properly?

I have ssh login to an ESXi 5 host. All the guests have vmware tools running, so they can be shut down by the host properly. I would like an equivalent for this menu option in vSphere client: It ...
mit's user avatar
  • 1,934
3 votes
4 answers
1k views

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, ...
Samselvaprabu's user avatar
3 votes
1 answer
28k views

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 ...
Matt's user avatar
  • 1,893
3 votes
3 answers
8k 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 ...
TechGuyTJ's user avatar
  • 792
3 votes
2 answers
22k views

Query ESXi memory slots/installed memory modules from PowerCLI 4.1

I have a VMware infrastructure with some ESXi 4.1 hosts and a vCenter Server 5.0 installed. I need to extend our hardware inventory with the following info: how many memory slots are available in ...
Zizzencs's user avatar
  • 947
3 votes
2 answers
257 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 ...
agentroadkill's 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 ...
Devnull's user avatar
  • 951
3 votes
2 answers
7k views

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 ...
sjw's user avatar
  • 374
3 votes
2 answers
900 views

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 ...
Chadddada's user avatar
  • 1,680
3 votes
3 answers
2k views

Is it possible to add root ssh keys to /etc/ssh/keys-root/authorized_keys on ESX hosts without having to log into every box?

I have close to 70 ESX hosts that need to have the root SSH keys added to them. Is there a way to do this through vsphere or powercli, or will I have to manually SSH into each box and add the line to ...
EGr's user avatar
  • 609
2 votes
1 answer
578 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?
Adam Chance's user avatar
2 votes
2 answers
9k views

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 ...
Valrok's user avatar
  • 330
2 votes
2 answers
1k 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: ...
witchkinkofAngmar's user avatar
2 votes
3 answers
2k views

'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 -...
Yolo Perdiem's user avatar
2 votes
2 answers
2k 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 ...
Marki's user avatar
  • 2,854
2 votes
1 answer
4k 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\...
Uh Trog's user avatar
  • 103
2 votes
2 answers
2k views

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 ...
Mehmet Inoglu's user avatar
2 votes
1 answer
4k views

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 "...
SeanKilleen's user avatar
  • 1,083
2 votes
0 answers
91 views

How can I assign a vSphere Tanzu license to a Supervisor Cluster programmatically?

I have a vSphere Tanzu license already available in my vCenter Server. Now I want to assign that license to a Supervisor Cluster. It works through the vSphere Webclient manually, but I need to do it ...
stackprotector's user avatar
2 votes
0 answers
228 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 ...
DanMan3395's user avatar
2 votes
1 answer
506 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. ...
user230027's user avatar
1 vote
2 answers
315 views

When a VM Template was last used (to create a VM)?

I need to know when a VM Template was last used (to create a VM)? As I am working on a project of segregating unused templates in my vSphere environment, I need to know that answer. I tried Get-...
RichardWizards's user avatar
1 vote
1 answer
853 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 -...
Root Loop's user avatar
  • 902
1 vote
1 answer
420 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 ...
John John's user avatar
  • 419
1 vote
1 answer
615 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,...
2legit2quit's user avatar
1 vote
1 answer
108 views

Scripting changes to the vNIC in vSphere for a cloned VM

After deploying a Windows VM clone from a template, how can a script be written to change the network the vNIC is on ("Network label" in the VM Settings window) and enable the NIC? I'm working with ...
warren's user avatar
  • 18.6k
1 vote
1 answer
185 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 ...
Glenn Sullivan's user avatar
1 vote
1 answer
706 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-...
SmudgerDan's user avatar
1 vote
1 answer
542 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 [email protected] account to connect to my VCSA 6.7 U2 server. If i use Get-VM cmdlet without ...
Paolo RSE's user avatar
1 vote
1 answer
2k 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?
red888's user avatar
  • 4,233
1 vote
1 answer
551 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,@{...
2legit2quit's user avatar
1 vote
1 answer
321 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 ...
John John's user avatar
  • 419
1 vote
2 answers
835 views

Gathering buslogic SCSI hardware and virtual machine operating system

I'm trying to use Powershell to get SCSI hardware from several virtual servers and get the operating system of each specific server. I've managed to get the specific SCSI hardware that I want to find ...
Valrok's user avatar
  • 330
1 vote
2 answers
2k views

PowerCLI: How can I find an ESXi host's system memory?

A view of a VM host gives me the field .Config.ConsoleReservation, but ESXi doesn't have the console any more. The vSphere GUI shows total memory and system memory for ESXi hosts. How can I get an ...
Andrew J. Brehm's user avatar
1 vote
1 answer
4k views

Resetting the VMware PowerCLI global:DefaultVIServer and global:DefaultVIServers system variables?

Can anyone here please assist me in resetting the global:DefaultVIServer and global:DefaultVIServers system variables into $null ? because I cannot do anything with my PowerShell anymore even after ...
Senior Systems Engineer's user avatar
1 vote
0 answers
29 views

ISO not booting using powwercli

Using below codes I am able to mount ISO to the CD drive of a VM and change the BootOrder of the VM $CloneVM = Get-VM -Name "999_SW999OSTest_Clone" $IsoPath = "[NPROD_LUN-01_DEV_3333] ...
snehasish nandy's user avatar
1 vote
1 answer
3k 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 ...
karthick's user avatar
  • 327
1 vote
0 answers
48 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 ...
Saurabh Mandlik's user avatar
1 vote
0 answers
164 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 ...
Johannes B. Latzel's user avatar
1 vote
0 answers
99 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 ...
Hexalogy's user avatar
1 vote
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 = ...
user54614's user avatar
  • 379