Quantcast
Channel: VMware Communities : Discussion List - Automation Tools
Viewing all 9071 articles
Browse latest View live

using powercli to control limit disk iops

$
0
0

Hey there, I need to limit the iops of the disks connected to my virtual machines via powercli.

 

I am  using the following command :

Get-VM 'vm_name' | Get-VMResourceConfiguration | Set-VMResourceconfiguration -configuration DiskResourceConfiguration -DiskLimitIOPerSecond 100

 

But this gives an error:

 

Set-VMResourceConfiguration : Cannot bind parameter 'Configuration'. Cannot convert the "DiskResourceConfiguration" value of type "System.String
" to type "VMware.VimAutomation.ViCore.Types.V1.VM.VMResourceConfiguration".
At line:1 char:86
+ Get-VM $vm | Get-VMResourceConfiguration | Set-VMResourceconfiguration -configuration <<<<  DiskResourceConfiguration -DiskLimitIOPerSecond 10
0
    + CategoryInfo          : InvalidArgument: (:) [Set-VMResourceConfiguration], ParameterBindingException
    + FullyQualifiedErrorId : CannotConvertArgumentNoMessage,VMware.VimAutomation.ViCore.Cmdlets.Commands.SetVMResourceConfiguration

 

 

Can someone please suggest me, where am I going wrong ?


RDM LUN size mismatch

$
0
0

While listing the size of RDM LUNs for a MSCS/WFCS database VM, noticed one LUN's size that i got using a PowerCLI script is different (180GB) than what is listed on vSphere Client devices screen (300GB)....then checked using esxcfg-scsidevs -c |grep naa.id and this shows its size same as vSphere client (300GB)

 

now checked the associated vm_name-rdmp.vmdk file size and it was same as what i got initially from powercli (180GB)....rvtools is also showing the same.

 

Note: From inside VM, this is a 300GB RDM Disk

 

If I understand correctly, in datastore browser RDM pointer file's size (vm_name-rdmp.vmdk) would be listed same as RDM's actual size then why its different here.....Can someone help me here to understand why the same RDM's LUN size is showing differently?

List VMFS and RAW disks with naa.id and multipath policy

$
0
0

Hi everyone, I need a powercli script that lists fields below disk naa.id - shows it as RDM or VMFS - Multipath Policy (Fixed or RR) Could anyone help me out? Thanks a lot.

Can I get the memory usage of each process on ESX through powercli?

$
0
0

Hi,

Can I get the memory usage of process on ESX?

Like what "esxtop" command can do:

      ID      GID NAME                                MEMSZ   GRANT     CNSM    SZTGT     TCHD   TCHD_W %ACTV %ACTVS %ACTVF %ACTVN    SWCUR    SWTGT   SWR/s   SWW/s

6022074  6022074 CFT_DS_NFS_U64_  2048.00  1858.00  1858.00  2056.28  1658.88  1638.40    67     64     68     22     0.00     0.00    0.00    0.00

6025086  6025086 CFT_DS_NFS_U64_  2048.00  1866.00  1866.00  2060.53  1617.92  1617.92    78     70     74     47     0.00     0.00    0.00    0.00

    9793     9793 hostd.34366        72.07    48.12    48.12    52.93    19.33    19.33     0      0      0      0     0.00     0.00    0.00    0.00

4747375  4747375 sfcb-ProviderMa    28.48    18.68    18.68    20.55    11.20    11.20     0      0      0      0     0.00     0.00    0.00    0.00

4741823  4741823 vpxa.791587        27.03    17.82    17.82    19.60     5.80     5.80     0      0      0      0     0.00     0.00    0.00    0.00

How to create LAG and assign uplinks?

$
0
0

Anyone know how to create a lag on a distributed switch and assign uplinks to it with PowerCLI 6.3?  I can't seem to figure this out and Google has not been much help.  Is this even possible to do with PowerCLI?  I'm starting to think it isn't.

 

Thanks

Powercli to get RAID level

$
0
0

Dear all,

.

In our environment, ESXi will be installed on the local harddisk of the server.

 

So, I would like to get the RAID level of the harddisk where the esxi is installed .

If above is not possible, is there a way to fetch the physical harddisk and its sizes, where the host is installed.

 

Eg : Either i need an answer as RAID 5 or

i require answer as Physical disk 1 - 100 GB Physical disk 2 - 100 GB , physical disk 3 - 100GB

So by fetching the local datastore size, i can get the configured RAID level.

 

Please help

PowerCLI won't work after clean, fresh installation

$
0
0

Hi All,

 

I was working on some nice Powershell scripts but after my laptop crash I cannot seem to get it working anymore.

Several clean, fresh installations of Windows 10 still i get errors;

 

my steps;

Installing Windows feature .NET 3.5 and .NET 4.5

In Powershell, I set the executionpolicy to unrestricted

Executing VMware-PowerCLI-6.3.0-3737840

After installation, I start PowerCLI, but the command connect-viserver is not available.

Even though I have issues, I still want to install VIToolkit (VMware-Vim4PS-1.5.0-142961)

 

After I've done that all, I want to start but all my modules are failing.
I do see them in

Get-Module -ListAvailable

 

ModuleType Version    Name                                ExportedCommands

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

Binary     6.0.0.0    VMware.VimAutomation.Cis.Core

Binary     6.3.0.0    VMware.VimAutomation.Cloud

Manifest   6.3.0.0    VMware.VimAutomation.Common

Manifest   6.3.0.0    VMware.VimAutomation.Core

Binary     6.0.0.0    VMware.VimAutomation.HA

Binary     1.0.0.0    VMware.VimAutomation.License

Binary     6.0.0.0    VMware.VimAutomation.PCloud

Manifest   6.3.0.0    VMware.VimAutomation.SDK

Binary     6.0.0.0    VMware.VimAutomation.Storage

Binary     6.3.0.0    VMware.VimAutomation.Vds

Binary     6.3.0.0    VMware.VimAutomation.vROps

Binary     6.0.0.0    VMware.VumAutomation

 

 

When I load a script that will import them, I get the following errors;

 

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.Cloud

Import-Module : Could not load file or assembly 'VMware.VimAutomation.ViCore.Types, Version=6.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

At line:1 char:1

+ Import-Module VMware.VimAutomation.Cloud

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

 

 

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.Common

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.Core

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.HA

Import-Module : Could not load file or assembly 'VMware.VimAutomation.ViCore.Util10Ps, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

At line:1 char:1

+ Import-Module VMware.VimAutomation.HA

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

 

 

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.License

Exception calling "OnImportModule" with "2" argument(s): "A provider is not available for the following required component service: ViCoreService"

At C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Modules\VMware.VimAutomation.License\Initialize-SDKComponent.ps1:1 char:1

+ [VMware.VimAutomation.Sdk.Interop.V1.CoreServiceFactory]::CoreService ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

    + FullyQualifiedErrorId : NotSupportedException

 

 

Import-Module : Could not load file or assembly 'VMware.VimAutomation.ViCore.Util10Ps, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

At line:1 char:1

+ Import-Module VMware.VimAutomation.License

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

 

 

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.PClou

Import-Module : The specified module 'VMware.VimAutomation.PClou' was not loaded because no valid module file was found in any module directory.

At line:1 char:1

+ Import-Module VMware.VimAutomation.PClou

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceUnavailable: (VMware.VimAutomation.PClou:String) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

 

 

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.PClou

Import-Module : The specified module 'VMware.VimAutomation.PClou' was not loaded because no valid module file was found in any module directory.

At line:1 char:1

+ Import-Module VMware.VimAutomation.PClou

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceUnavailable: (VMware.VimAutomation.PClou:String) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand

 

 

PS C:\Users\Dave Greebe\Dropbox\Powershell_Scripts\PowerScripts_trunk\Single scripts> Import-Module VMware.VimAutomation.PCloud

Import-Module : Could not load file or assembly 'VMware.VimAutomation.ViCore.Types, Version=6.3.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

At line:1 char:1

+ Import-Module VMware.VimAutomation.PCloud

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Import-Module], FileNotFoundException

    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.ImportModuleCommand

 

I really don't understand this why its failing.

 

Hope that someone can help me with this...

 

Thanks in advance

 

Dave Greebe

cluster name of a resource pool

$
0
0

I am trying to find the name of the Cluster of a Resource Pool in vCenter. Tried running Get-ResourcePool, but couldn't find cluster info.

 

My input would be -

> name of ResourcePool

> name of vCenter and credentials

 

and get the name of cluster where the resource pool is created. Could someone help please?


Custom DNS Suffixes

$
0
0

Hi All,

 

How do I add a simple DNS suffix such as a wildcard "*.ldn" or even "ldn" to custom dns suffixes?

 

I can add suffixes such as "mydomain.local" etc but not ldn on its own I have to manually add the search suffix for it to accept ldn

 

set-vmhostnetwork $vmHostNetworkInfo -hostname $esxhostname -SearchDomain "mydomain.local","MYDOMAIN.LOCAL","ldn"

 

is there a way to do this

Registering copied VM in Power CLI 6.3 / vCenter 6 / ESXi6 fails

$
0
0

Power CLI script copies paused VM and registers clone to vcenter with new name.  The script worked under vCenter 5.5, Power CLI 5.5 w/ ESXi 5.1, but on Vcenter 6.0 / Power CLI 6.3 / ESXi 6.0 this fails.

New-VM -VMFilePath "$DestinationVMfile" -ResourcePool $SourceVMrespool -Name $SourceVMname-Copy

"The virtual machine which was created by task '<some task>' was not found.  The likely cause is that the virtual machine was removed.  The task name was 'RegisterVM_task'"

 

If it is of any relevance, the Vmware 6 environment is running on a Nutanix cluster.  The VMWare 5.5 environment is a Dell VRTX.

 

If I try to run the New-VM command a second time with the same copy, I get a different error:

"The specified key, name, or identifier "<Vmware>-Copy" already exists"

This error is the same, even if I run the command with a different -Name value on the same copied files.

 

So while the first run isn't succeeding, I suspect it at least did some of the work for registering the VM (maybe it gets put in a database somewhere?), but I can't see the registered machine in vSphere.

Is there a way to specify the EXACT OS Version installed on your VMs?

$
0
0

I am looking to see what VMs I have that are Windows 2012 R2.  I wrote a quick script (below) to list all of my 2012 VMs, but there are over 50 and I was looking for an easy way to only list the VMs that are 2012 R2.  Anyone have any ideas?

 

get-vm | where {$_.Guest.OSFullName -like "Microsoft Windows Server 2012 (64-bit)"} | Select Name | export-csv -notypeinformation c:\Win2012_VMs.csv

 

Thanks in advance,

Export VM as an OVA file using powercli - unexpected error

$
0
0

I am trying to export an ova-file using powercli but with no success. It do work when I login with the same user in the vSphere client but not with powercli.

 

Get-VM -Name "my test VM 150505 12345" | Export-VApp -Destination "L:\Backup 150505\" -Format Ova

Export-VApp : 2015-05-05 17:22:46    Export-VApp        Object reference not set to an instance of an object.

At line:1 char:42

+ Get-VM -Name "my test VM 150505 12345" | Export-VApp -Destination "L:\Backup 150 ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : NotSpecified: (:) [Export-VApp], ViError

    + FullyQualifiedErrorId : Client20_NfcLease_RunNfcTask_Error,VMware.VimAutomation.ViCore.Cmdlets.Commands.ExportVApp

 

I have also tried to use the -VM parameter insted of pipelining with the same result.

 

* I have verified that the VM does exist - $vm = Get-VM -name "my test VM 150505 12345" does work.

* When I run the command above, I can see that the ...ova.tmp file is created in the directory and then deleted prior to the error.

* In the vSphere client, the "Recent Tasks" says "Export OVF template ...... The task was canceled by a user."

 

Thank you for any suggestions/hints.

/Mats

Error while configuring Infrastructure Traffic Resource

$
0
0

hi,

im trying to configure some Infrastructure Traffic Resource, but while creating a dpec object i get this error:

 

 

    $dvswitch = get-vdswitch | select -First 1

    $spec = New-Object VMware.Vim.VMwareDVSConfigSpec

    $spec.configVersion = $DVSwitch.ExtensionData.Config.ConfigVersion

    $spec.InfrastructureTrafficResourceConfig = New-Object VMware.Vim.DvsHostInfrastructureTrafficResource

    $spec.InfrastructureTrafficResourceConfig.AllocationInfo = New-Object VMware.Vim.DvsHostInfrastructureTrafficResourceAllocation

 

 

    The property 'AllocationInfo' cannot be found on this object. Verify that the property exists and can be set.

    At line:1 char:5

    +     $spec.InfrastructureTrafficResourceConfig.AllocationInfo = New-Object VMware ...

    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        + CategoryInfo          : InvalidOperation: (:) [], RuntimeException

        + FullyQualifiedErrorId : PropertyAssignmentException

Selecting specific value of a property

$
0
0

Get-VIEvent-Start (Get-Date).AddHours(-14) -MaxSamples ([int]::MaxValue) |

where {$_.GetType().Name -eq"TaskEvent"}

 

Lists all TaskEvents from the last 14 hours - good

However, I want to select date/time, message and VM name

 

date/time and message no problem just:

selectCreatedTime,FullFormattedMessage

 

No idea how to get VM name so I can export this lot into a CSV.  VM name is a value (what is this called? Property attribute?) within the VM property of the Get-VIEvent object.  I just don't know how to extrapolate this particular single piece of a property into my output.  If I wanted just the name with no other info then:

select-ExpandPropertyVm

would work fine but I want the name alongside date/time and message.

 

Help please!

Disable VAAI ATS by powercli


How do I list all the vApps (and VMs in each vApp) in all of an organization's catalogs?

$
0
0

We are transitioning from vCloud Director 5.5 (VCD) to vRealize Automation 7 Standard (vRA).

 

I am tasked with moving the 500 VMs that are in catalogs under VCD into vRA.

 

Here is my psuedo code:

 

foreach vApp in all the VCD catalogs in all the organizations {

     On the vCenter that VCD uses {

          Make a thin-copy of the VMs in the vApp

          Migrate this new thin VM to shared NFS storage (the storage is used by both the VCD-vCenter and the vRA-vCenter)

          Wait until migration is complete

          Unregister this new thin VM

     }

     On the vCenter that vRA uses {

          register the VM

          migrate the VM off of shared storage and onto the fibre channel storage that vRA uses; place in appropriate folder

          make a snapshot of the VM as we are using linked-clones on vRA and linked-clones only work off of snapshots

     }

     On vRA {

          create linked-clone blueprint based on the snapshot

     }

}

 

Thoughts?

 

 

Thanks!

 

-Chris

VCD VM Migration

$
0
0

What is the best way to use PowerCLI to migrate a virtual machine from vCloud Director to vRealize automation? 

PowerCLI, vSphere 6.0 bug? Missing "disk.used.latest" StatType for interval 7200

$
0
0

I currently have a ticket open for this with VMware support and they keep giving me the runaround on this so I am hoping to enlist the members of this community to determine whether this is a bug or not.

 

We were on a Windows install of vCenter Server 5.5 U2e with ESXi 5.5U2 hosts and this was working fine.  We upgraded our vCenter first to 6.0.0a, then 6.0.0b, then 6.0U1, where we are at now.  The vCenter versions are the relevant versions here, not the ESXi host installs.  This broke somewhere in this vCenter upgrade path and I'm not sure which version broke it.


There are four intervals (in seconds) of stat performance data that are collected and rolled over from table to table:  300, 1800, 7200, 86400.  I won't go into how these are rolled into each other or the statics logging levels as we believe the data within the tables is actually irrelevant to the bug at hand.  From within PowerCLI, you can see each of the StatTypes for each interval by executing the following commands:


Get-StatType -Interval 300 -Entity <name of VM> | sort

Get-StatType -Interval 1800 -Entity <name of VM> | sort

Get-StatType -Interval 7200 -Entity <name of VM> | sort

Get-StatType -Interval 86400 -Entity <name of VM>  | sort

 

where <name of VM> is of course the name of any VM within your vCenter.  This will output something like:

 

cpu.ready.summation

cpu.usage.average

cpu.usagemhz.average

disk.maxTotalLatency.latest

disk.provisioned.latest

disk.unshared.latest

disk.usage.average

disk.used.latest

...

 

Each one of these is a stat type for which data is collected.  If you compare the output of all 4 commands above, you should notice that the stat type "disk.used.latest" is not listed in the output of the 7200 command.  It's just gone.


You can then see the actual data for each one of these stat types by executing the following command:

 

Get-Stat -Entity <name of VM> -Stat <StatType> -IntervalSecs <Interval in seconds>

 

The issue, and what we believe to be a bug, is that "disk.used.latest" is now missing from 7200 as mentioned above.  If I execute the following commands:

 

Get-Stat -Entity <name of VM> -Stat disk.used.latest -IntervalSecs 300

Get-Stat -Entity <name of VM> -Stat disk.used.latest -IntervalSecs 1800

Get-Stat -Entity <name of VM> -Stat disk.used.latest -IntervalSecs 7200

Get-Stat -Entity <name of VM> -Stat disk.used.latest -IntervalSecs 86400

 

the 300, 1800, and 86400 intervals output the data for "disk.used.latest" just fine.  However, the 7200 interval kicks out the following error:

 

"Get-Stat : 6/8/2016 10:20:24 AM    Get-Stat        The metric counter "disk.used.latest" doesn't exist for entity"

 

The issue is that since this metric is missing in 7200, the stats for it fail to roll up into the 86400 interval.  Currently the newest data I have for disk.used.latest in 86400 is 7/11/2015 which is when we upgraded to 6.0.0a.  The oldest data for 86400 is 6/9/15.  This is because 7200 has failed to roll up this data into 86400 since we upgraded but yet the data is still being purged at one year old daily.  On 7/11/2016, all my data for "disk.used.latest" in 86400 will be gone.

 

VMware support keeps going off on a tangent related to how it rolls up data, completely glossing over the fact that the 7200 interval isn't collecting this disk.used.latest metric because it simply doesn't exist and therefore there is nothing to roll up into 86400.

 

So...  I could use some help proving me right or wrong on this.  I only have access to a 6.0U1 vCenter, where this is broke.  What I would like is for someone, or multiple people, to execute the below commands in a PowerCLI session on the following vCenter versions, 6.0 GA, 6.0.0a, 6.0.0b, 6.0U1, 6.0U1b, 6.0U2

 

Get-StatType -Interval 300 -Entity <name of VM> | sort

Get-StatType -Interval 1800 -Entity <name of VM> | sort

Get-StatType -Interval 7200 -Entity <name of VM> | sort

Get-StatType -Interval 86400 -Entity <name of VM>  | sort

 

And simply check to see if "disk.used.latest" is in the list of stat types for all intervals.  If I am right and this is a bug, it should be missing for the 7200 interval, depending on the vCenter version.  Checking this on each 6.0 vCenter version should tell us on what version it broke and if future versions have fixed it.  It would probably help if the vCenter was upgraded from a previous 5.x version, not sure if this issue will be present in new installs. And I'm not sure if VCSA would show this problem or not.


Report back here your findings, if you too are missing the "disk.used.latest" stat type in any of the intervals or if you have it present in all intervals, and what version/build number of vCenter you checked against.


Thanks in advance!

Eager Zeroed Thick Automation

$
0
0

Hello,

I know that you can set a vmdk Eager Zeroed in the vc client but is there a way to set that value in vco or python for automation?  As far as i know I can only set to either think or thin

Script need

$
0
0

can any one please help me in writing the script for the below requirements. I am using the Power CLI Vesrion 2.0.

 

Script 1(Cluster level):

Number of Host in Cluster:

Number of VM's in Cluster:

Number of powered Off VM's in Cluster:

Total Memory in Cluster:

Total allocated Memory in Cluster:

Average utilization of vCPU in Cluster:

 

 

Script 2(VM level):

Snapshot enabled for the VM: Yes or NO

Datastore Name where the vswap is located:

Available datastore free size (where the vSWAP file is located):

VMware tools Version:



Thanks in Advance..!!!

Viewing all 9071 articles
Browse latest View live


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