Quantcast
Channel: VMware Communities : All Content - VMware PowerCLI
Viewing all 16717 articles
Browse latest View live

'VMWare.VimAutomation.Core' is not installed on this computer

$
0
0

Is there a way to connect to the console of a shared VM over a SSH tunnel?

 

I'm running Workstation 14 on Windows 10.

 

If I create a SSH tunnel to a remote Linux machine running Workstation 14, I can connect to the remote machine's Workstation 14 with my Workstation 14.

I see the VMs and can I see the power controls if I right click on a VM.

 

However, if I attempt to view the remote VM's console I get the following error:

 

Unable to connect to the MKS: The remote host certificate has these problems:

 

* A certificate in the hosts's chain is based on an untrusted root.

* The certificate is based on an untrusted root.

* Host name does not match the subject name(s) in certificate.

* Self signed certificate.

 

According to this KB article, there's an option in ESX (?) to disable the certificate check. I can't find anything equivalent in Workstation.

 

Thank you.


change root password of all ESXi hosts in a cluster

$
0
0

Hi,

 

I would like to change root password of all ESXi hosts in a cluster through CLI

 

Please help

Login xml file for multiple vcenter - VICredentialStoreItem

$
0
0

Hello, I have a script to run every day (powershell) and it connecting with three different vcenter,
I need to create login credential file,

 

Should I create separate login files? Is possible to create a unique file with same credential for all of them? (3 different IP)

 

Add-PSSnapin vmware.VimAutomation.core
New-VICredentialStoreItem –Host 10.0.0.10 –User EU\gemela –Password ######## –File C:\Users\gemela\my.xml
$logincred = Get-VICredentialStoreItem -Host 10.0.0.10 -File C:\Users\gemela\my.xml

 

 

Thanks

Reverse lookup - Get-VM to Get-CIVM possible?

$
0
0

Hi all,

I know that it's possible to go from vCloud Director to vSphere simply with:

Get-CIVM | Get-VM

But I am looping through VMs from the vCenter side, and need to lookup the VM's vApp, owner etc. if it's a vCloud Director VM.

I.e. reverse of the above:

Get-VM | Get-CIVM  #does not work!

Can someone please point me in the right direction how to do this?  I'm running vCloud Director 9.0 and 5.5.  I can generate a list of all the vCloud VMs along with their vApp, owner etc. and then use this as a lookup, but is there a better/faster way?

Thanks!

Khare

host profile and associated hosts via powercli

$
0
0

Hi All,

 

How can I query the host profile and associated hosts with it? The closest thing I get is this.

 

(Get-VMhostProfile hostprofilename).extensiondata.entity

 

Type                         Value

-----                         ------

HostSystem          host-3026

HostSystem          host-3028

 

But, I am not getting the hostname and get only host value.

NAA ID List Required.

$
0
0

We have a requirement for Storage Vendor Migration, We need all LUN naaid's and vendor names, Environment having RDM Disks, Datastores and unused LUN's mapped to the Host.

 

It's possible to provide the Script it should take all LUN Naaid connected ESXi Host for datastore, RDM, unused LUN and RDM disk.

Unable to create Local User on VCSA 6.7 with API

$
0
0

I want to create local User on my vCenter VCSA 6.7 with Api

 

Here my code

 

Connect-CisServer -Server 192.168.0.115 -User administrator@vsphere.local -Password 123456+Aze

$name = "jerome"

$fullname = " JM2K69"

$role = "superAdmin"

[VMware.VimAutomation.Cis.Core.Types.V1.Secret]$Password = "VMw@re123"

$userAPI= Get-CisService 'com.vmware.appliance.local_accounts'

$createSpec=$userAPI.Help.create.config

 

    $createSpec.full_name = $fullname

    $createSpec.roles = $role

    $createSpec.password = $password

    $userAPI.create($name,$createSpec)

 

If you have some idea ? Thx

Connect-VIServer through firewall to vCSA 6.0 with External PSC

$
0
0

Hi

I am having difficulties connecting with PowerCLI 10.0 through firewalls to a vCSA 6 with External PSC.

I have requested TCP 443 be allowed through to the vCSA and I can see in the FW logs the traffic is getting through.

However when I try

 

Connect-VIServer -Server vCSA.domain.com

 

I get back this error

 

Connect-VIServer : There was no endpoint listening at https://PSC.domain.com/lookupservice/sdk that could accept the message.

 

I have another server with firewall rules allowing access using PowerCLI 6.3 which can connect without error.

 

Should TCP 443 to the vCSA be sufficient for PowerCLI connections? Or do I need to be able to reach the PSC?

 

Has anything changed in PowerCLI that would be causing this?

 

Thanks

Mark


When will the next version of PowerCLI be released to support vSphere 6.7. Specifically for Instant Clones.

$
0
0

When will the next version of PowerCLI be released to support vSphere 6.7.  Specifically for Instant Clones.

New-VM, datastore directory structure confusion

$
0
0

Hello,
I am evaluating VM deployment methods and am looking at PowerCLI. I am new to vSphere and am seeing a behavior which I do know is expected or not so I'm hoping for some help sorting this out.

Using PowerCLI 10 latest version against vSphere 6.5.0.13000, I create a new VM such as:

$vm = New-VM -ResourcePool $cluster -Datastore $ds -Name $vmName -HardwareVersion vmx-13 -GuestId windows9Server64Guest -MemoryMB 8192 -NumCpu 4 -CoresPerSocket 1 -Portgroup $portGroup

This command yields two different directories created on the Datastore:

$vm.ExtensionData.Config.files   VmPathName : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/BEB-02.vmx SnapshotDirectory : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/ SuspendDirectory : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/ LogDirectory : [ds-gen9-vm-01] 0032e35a-4804-5eeb-136e-9cdc714b31d0/ FtMetadataDirectory :

and:

dir vmstore:\LAB\ds-gen9-vm-01\BEB-02  Name Type Id ---- ---- -- .sdd.sf DatastoreFolder .dvsData DatastoreFolder BEB-02.vmdk DatastoreFile BEB-02.vmx DatastoreFile BEB-02.vmsd DatastoreFile BEB-02-0172bd4d.hlog DatastoreFile


The .VMX file is in two locations.

Also,
When I add an additional virtual hard disk using the New-HardDisk cmdlet,
it is created within the VmPathName directory, NOT the BEB-02 directory where the
original VMDK file was created.

Any explanation and documentation references would be appreciated.

I would think you would want all VM related files to be located under a single folder
with the VM name for easy management and support of the environment. If this is possible
how do I enable it?

Thank you for your help with this.

Brian

Powercli script to get datacenter and it's clusters, hosts ands vm's in a CSV file.

$
0
0

HI -

      I need a help to write a powercli-script which collect vcenter informations such as list of each Datacenter and it's Clusters, hosts and vm's in a CSV file.

 

Thanks in advance!!!

 

 

-Subash.

Check status of LUNs on hosts - script too slow

$
0
0

So I've been learning PowerCLI and managed to write a script that reads a list of LUNs from a text file and looks them up on hosts in a cluster.

The script tells what LUN in the list is mapped on the hosts and which of the mapped LUNs are administratively switched on or off. The ability to obtain this information is crucial in properly tracking hundreds of LUNs I'm un-mounting from several clusters as I assist our storage admins with decommissioning their end-of-life arrays.

 

The problem is, it takes a very long time for it to give me the result. I tested the script by looking up one LUN on a two node cluster and it took 1min 43sec to return a result.

Is there anyway to possibly speed it up? I need to be able look up several dozen LUNs at a time on 8 node clusters.

 

Any guidance on this is very much appreciated.

 

$luns=Get-ContentF:\lunlist.txt

$cluster=Get-Cluster-Name'mycluster'

     $hostlist=Get-Cluster$cluster|Get-VMHost

     Foreach($vhostin$hostlist)

         {

         $esxcli=Get-EsxCli-VMHost$vhost

         foreach($lunin$luns)

            {

            $mapped=$vhost|Get-ScsiLun-CanonicalName$lun-ErrorActionSilentlyContinue

            if($mapped)

                {

                $attached=$esxcli.storage.core.device.list($lun) |Select-ObjectStatus-ErrorActionSilentlyContinue

                if($attached.Status -ne'on')

                    {

                    Write-Host$lun'is administratively switched off on host'$vhost'in'$cluster-ForegroundColorCyan

                    }

                 Else{

                     $size=$esxcli.storage.core.device.list($lun) |Select-objectSize

                     Write-host$lun'-'$Size.Size'MB'"is attached to $vhost in $cluster"-ForegroundColorYellow

                     }

                }

           Else

                {

                Write-Host$lun'is not mapped to host'$vhost-ForegroundColorGreen

                }

           }

        }

 

 

WMWare.Vim.dll could not be loaded

$
0
0

Hi all,

 

I have installed PowerCLI Version 6.0.
I want to use the WMware API using the VMware.Vim.dll in my program. So I wrote this line of code using c# to load the .dll file.

 

Assembly assembly = Assembly.LoadFrom(fileLocation + @"\VMware.Vim.dll");

 

Unfortunately I get this error :

 

The file or assembly file: /// C: \ Program Files (x86) \ VMware \ Infrast
ructure \ vSphere PowerCLI \ VMware.Vim.dll "or a dependency on it was not found. The assembly is created by a runtime that is more recent than the
is currently loaded, and can not be loaded.

 

I have the same Problem with PowerCLI 6.5 and PowerCLI 10.0. I mean the file exist but I think I've Problem with compatibility.

 

PowerShell Version 3 is installed and .Net Framework 4.0.

 

Any Suggestions!!

Taher

Basic Cmdlet Failing - Exception has been thrown by the target of an invocation

$
0
0

So, I'm having a strange problem.

 

I have a weekly scheduled task to run this script that gets host and VM count.  It had been working fine for months.

Suddenly the VM count has been incorrect.

-----

Get-Cluster NAMEOFCLUSTER | Select Name, @{N="Host Count"; E={($_ | Get-VMHost).Count}},  @{N="VM Count"; E={($_ | Get-VM).Count}} | Export-Csv C:\Folder\file.csv

-----

 

So I started troubleshooting.  I took it back to basics and ran a "Get-Cluster NAMEOFCLUSTER" and it's working fine.

 

Soon as I pipe "Get-VM" to it, it doesn't work correctly.  It will get a few VMs sometimes and then crash with this error:

 

-----------------------------

get-vm : 4/30/2018 11:24:43 AM    Get-VM        Exception has been thrown by the target of an invocation.

At line:1 char:33

+ Get-Cluster NAMEOFCLUSTER | get-vm

+                                 ~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Get-VM], VimException

    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

-----------------------------

 

It's strange, sometimes it will get more of the VMs than other times.  Sometimes it wont get any at all and just throw that error.

 

If I just do a "Get-VM" without piping from "Get-Cluster" then it does get all the VMs correctly.

 

I tried to call VMware support about it but they said I had to have SDK Support for this issue and the standard ESXi/vCenter Support didn't cover this.

 

I've rebooted the vCenter but it didn't help.

 

Any ideas why this is suddenly failing?

 

Thanks!

Install PowerCLI 10.1 offline

$
0
0

Hello

 

I can't find anything regarding upgrading/installing PowerCLi 10.1.0 when the server is not connected to the internet.

 

Has anyone done this before?

 

Thanks


Powercli : current tasks of pools and VMs in Horizon View

$
0
0

Hello,

Is it possible to see the current tasks of poolls and VMs in powercli in Horizon View?

Thank You

PowerCLI 6.5 Release 1 and get-remotesessions

$
0
0

Hello:

I am testing out VMware PowerCLI 6.5 Release 1 on a new server
Everything seems to be working out except for one cmdlet that we are using in our scripts.

I understand that The Get-remotesession cmdlet was present in the old View module (and only works with powershell 2.0) and on the CS server only.

My question is there any similar cmdlet in 6.5.1?
Our current scripts queries the duration of a remote session.

PS C:\Users\administrator.VLAB> Get-RemoteSession


session          : 0
Username         : xxxx
pool_id          : xxxx
startTime        : Thu Feb 15 08:12:15 PST 2018
session_id       : xxxx
DNSName          : xxxx
duration         : 22 minutes
lastSessionTicks : -1223468
state            : CONNECTED
protocol         : BLAST

BTW, is there page that has a list of arguments that you can pass the VMware.HV.Helper cmdlets?

Thanks,
Chris

Hello:
 
I am testing out VMware PowerCLI 6.5 Release 1 on a new server
Everything seems to be working out except for one cmdlet that we are using in our scripts.
 
I understand that The Get-remotesession cmdlet was present in the old View module (and only works with powershell 2.0) and on the CS server only.
 
My question is there any similar cmdlet in 6.5.1?
Our current scripts queries the duration of a remote session.
 
PS C:\Users\administrator.VLAB> Get-RemoteSession

Script to Power On VMs That Are Off

$
0
0

I'm looking for a quick PowerCLI script that will power on any VMs that are powered off in a folder. I plan on setting a task to run daily at a certain time for a VDI folder where end users sometimes shut down machines. The script should ignore any VM that's powered on, but power on and VM that's off.

 

I'm not a scripting genius, so I was hoping someone had a similar script sitting around. Using Google and looking over this forum, the scripts seemed to be more for powering off and on VMs using a CSV / .TXT, but I'm just hoping for something that powers on any VMs that are powered off without needing to create or maintain a text file.

 

Thanks in advance

Script to count host build numbers

$
0
0

Hi,

 

Our environment has a mixture of hosts on different build numbers. I'm trying to write a script that will show a count of how many hosts are running each build number. That way I can export it to Excel and make a pie graph to show the spread of versions.

 

Using the ImportExcel module, I can create a pie graph but it counts every single result as a new value to graph

 

This code "PieChart -title "Test" (Get-VMHost | Select Version, Build)" generates a graph like below

 

 

If I could spit out counts like in the table below, I'd be able to create a Pie Chart like this:

  

ESXi BuildCount
6.0.0-460094410
6.0.0-50505933
6.0.0-52249345
6.0.0-55726564
6.0.0-67650622
6.0.0-69213843
6.0.0-750463764

 

Thoughts?

Used Space of a multi-datastore connected VM per datastore wise | PowerCLI

$
0
0

Hi Someone,

I am looking for powercli commands to get the used space of a VM associated with a particular datastore. And I want this into a csv for all datastores to which the VM has some storage attached.

Thanks

MG

Viewing all 16717 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>