Questions tagged [powercli]
VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell
82
questions
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 ...
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 ...
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 ...
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 ...
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 ...
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?
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 ...
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 ...
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 ...
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 ...
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, ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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 ...
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?
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 ...
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: ...
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 -...
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 ...
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\...
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 ...
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
"...
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 ...
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 ...
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. ...
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-...
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 -...
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 ...
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,...
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 ...
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 ...
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-...
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 ...
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?
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,@{...
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 ...
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 ...
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 ...
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 ...
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] ...
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 ...
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 ...
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 ...
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 ...
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 = ...