Questions tagged [powercli]
VMware PowerCLI is a command-line and scripting tool built on Windows PowerShell
83
questions
1
vote
0
answers
21
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] ...
0
votes
0
answers
44
views
VMware Guest VM Join My Own Domain With Netdom Fails ""DNS name contains an invalid character"
Trying to join a VMware guest VM to my domain. I'm running the Powershell script from one of my other guest vm's in VMware vCenter. I've tried changing the $Domain variable to other string names ...
0
votes
0
answers
19
views
vmware tag and description
i have created some tags with description in vcenter like
TAGS DESCRIPTION
AppOwner Brad pit
APpOwnerEmail [email protected]
Environment NIIT-UAT
and attached to a ...
0
votes
0
answers
270
views
PowerCLI, Invoke-VMScript cannot get the script's exit code
I have a PowerShell scripts that uses PowerCLI's "Invoke-VMScript" command to start scripts on a sequence of systems. If the script on the first server fails, the controller script should ...
2
votes
0
answers
80
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 ...
1
vote
2
answers
251
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-...
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: ...
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 ...
0
votes
1
answer
1k
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 ...
1
vote
0
answers
156
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
98
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
167
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
684
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-...
0
votes
1
answer
337
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 -...
1
vote
1
answer
523
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 ...
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 ...
2
votes
0
answers
207
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
1
answer
1k
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 ...
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 = ...
2
votes
1
answer
571
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
0
answers
365
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
1
answer
74
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
1
answer
534
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
1
answer
800
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
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' =...
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 ...
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 ...
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 ...
1
vote
0
answers
1k
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
2
answers
256
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
1
answer
874
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
1
answer
26
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
0
answers
50
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
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
546
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
2
answers
1k
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
0
answers
218
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
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 ...
1
vote
1
answer
307
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
1
answer
409
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
1
answer
4k
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
1
answer
1k
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
1
answer
138
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 ...
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\...
4
votes
1
answer
477
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
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 ...
1
vote
0
answers
329
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 -...
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,...
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 ...