chaderic20
Contributor
Contributor

Henrik,

Here is the most recent version of the script that I'm using.  There are a couple of lines you will need to change where I've removed my company's information and you'll have to put your company's information in.

In the line:

     Connect-VIServer -Server servername -WarningAction:SilentlyContinue

You will need to replace "servername" with the name of the vCenter server you want to connect to.  You will also need to run the script under a user account that has access to that vCenter server, or you will need to specifiy other credentials in the script.

In the line:

     foreach ($folder in (Get-View -ViewType "Folder" -Filter @{"Name" = "Folder name"}))

You will need to replace "Folder name" with the actual name of the folder you want to gather info from.  I only care about certain folders, so that is why I filter it down like that.  If you want to run the script against everything and not filter down to certain folders you can replace that entire for-loop with the lines:

     $Hosts += Get-View -ViewType "HostSystem"

     $VMs += Get-View -ViewType "VirtualMachine"

I think that should get you a report if you do that.  Let me know if you still have problems.

Chad

Reply
0 Kudos