How to get the type of the HDD in PowerCLI

I would like to determine each VM HDD type. Is it thin or thick? I realized that this question is not a trivial.

Here are the commands, which gather the type of the disc.

$vm = Get-VM -name testsrv

$thin = (((($vm |get-view).config).Hardware).Device | where {$_.GetType().Name -eq "VirtualDisk"}).Backing.ThinProvisioned
if ( $thin )
Write-Host "    Disk provisioning type: Thin"
Write-Host "    Disk provisioning type: Thick"

That’s all!


vCenter Server automated Inventory with PowerCLI

As you can see in my previous articles I created and filled in the Custom Attributes fields. The aim of the whole customization to store all data in the vCenter Server, easily do an automated inventory. The script not needs an SAP connection to gather the required information, because all data available in one information store.

Continue reading “vCenter Server automated Inventory with PowerCLI”

PowerCLI version Differences

I would like to write a PowerCLI script, which gather VMs memory information from vCenter Server. I realized that if I put one of the VM into a variable, it have different property on different PowerCLI versions. I develop the script on PowerCLI 5.1 Release 1, and I run it on PowerCLI 5.0.1, and the result was not fine.

Continue reading “PowerCLI version Differences”

Mass Custom Attribute Writes with PowerCLI

In my previous article I mentioned that how can you handle Custom Attributes. I would like to provide you an example script, witch read attributes from a CSV file, and insert it to vCenter Server line by line.

Continue reading “Mass Custom Attribute Writes with PowerCLI”

Write and read custom attributes

In my previous article I described that how you can create Custom Attributes. If it created, and ready to use, you should read and write all virtual machine’ Custom Attributes via vSphere Client or PowerCLI.

Continue reading “Write and read custom attributes”

Wired Custom Attributes window in vCenter Client

In my previous article I wrote about Custom Attributes. There are several reasons why you should use PowerCLI than vCenter Client. One of them is the bug of the vCenter Client GUI. My question is theoretical: Why the Custom Attributes window contains the Cancel button?

Continue reading “Wired Custom Attributes window in vCenter Client”

Create custom attributes with PowerCLI

As I mentioned one of my previous articles, I would like to write a PowerCLI script, which creates a fully automated inventory on my vCenter Server environment. Most of the information that I need stored on the vCenter Server database, but I need some additional data: owner, ordering ticket number, etc. Where can I store them? In the SAP – as the bookkeeper says. In an Excel file – as the manager says. No way! My recommendation is the vCenter Server database, easily accessible by my PowerCLI script.

Continue reading “Create custom attributes with PowerCLI”