Questions tagged [powercli]

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

Filter by
Sorted by
Tagged with
1
vote
1answer
15 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 ...
0
votes
1answer
142 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 ...
1
vote
0answers
86 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 ...
0
votes
1answer
371 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 ...
0
votes
1answer
444 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 = ...
2
votes
1answer
369 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?
0
votes
0answers
146 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: (...
0
votes
1answer
32 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 ...
0
votes
1answer
346 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-...
1
vote
1answer
216 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 -...
0
votes
0answers
2k 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' =...
0
votes
1answer
1k 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 ...
0
votes
1answer
1k 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 ...
2
votes
2answers
731 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 ...
1
vote
0answers
690 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 -...
3
votes
2answers
226 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 ...
0
votes
1answer
484 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 ...
0
votes
1answer
23 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?
1
vote
0answers
38 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 ...
1
vote
1answer
815 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
1answer
406 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,@{...
0
votes
2answers
807 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 ...
1
vote
0answers
128 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....
0
votes
1answer
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 ...
1
vote
1answer
175 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
1answer
232 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 ...
0
votes
1answer
2k 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-...
0
votes
1answer
867 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 ...
0
votes
1answer
126 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 ...
1
vote
1answer
2k 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\...
4
votes
1answer
394 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 ...
-1
votes
1answer
3k 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 ...
1
vote
0answers
208 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 -...
0
votes
1answer
527 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,...
3
votes
1answer
794 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
3answers
5k 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
3answers
9k 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 ...
2
votes
1answer
437 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. ...
9
votes
3answers
7k 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 ...
0
votes
1answer
783 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 ...
0
votes
1answer
2k views

finding guestid in offline documentation?

I have a little question thats been bugging me lately. I am using PowerCLI to create a new VM and I want to use the -guestId parameter to specify the Guest OS. Is there any built in documentation ...
2
votes
1answer
1k 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 ...
0
votes
2answers
733 views

Snapshot Reporting via Email

I've got the current script that is supposed to log onto vsphere, get all snapshots that are over a week old, and email the results. Connect-ViServer server $weekOldSnapshots = (Get-Date).AddDays(-7)...
5
votes
1answer
775 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 ...
1
vote
2answers
805 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 ...
0
votes
1answer
47 views

Method of obtaining SCSI hardware on all virtual servers

I'm looking for a method to check what the SCSI hardware of a VM is and identify any servers that have virtualbuslogic. I'm trying via PowerCLI to make this happen although I'm not sure how to specify ...
1
vote
1answer
259 views

How do I create an IP Pool using PowerCLI?

Datacenter objects have a tab "IP Pools" to create IP pools for vApps (as I understand it). How can IP pools be created or modified using PowerCLI?
2
votes
2answers
8k 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
3answers
1k 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 ...
1
vote
3answers
1k 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 -...