Script of VM inventory for VM name with the location, the name of the Cluster and data storing total size and free space in the data store.

Hello
I'm looking for small changes in the script. I want the output to the database in GB and not MB. Any help on this will be appreciated.

$vc = to connect-viserver "e.g. name VC.
$report = @)
{foreach ($vm in Get - VM)
$ds = get - Datastore - VM $vm
$report += $ds. Select @{N = "Name"; E = {$vm}},
@{N = 'Cluster'; E = {Get-Cluster - VM $vm}},
@{N = "ESX host"; E = {(Get-VMHost-VM $vm).} Name}},
@{N = "Datastore"; E={$_. Name}},
@{N = 'Capacity DS'; E={$_. CapacityMB}},
@{N = "DS free"; E={$_. FreeSpaceMB}}
}
$report | Export-Csv - NoTypeInformation C:\VM_CLuster_Host_Datastore.csv

Thank you

vmguys

Use the constant of builtin PowerShell 1 KB

$vc = connect-viserver "eg VC name" $report = @()
foreach($vm in Get-VM){
    $ds = Get-Datastore -VM $vm    $report += $ds | Select @{N="Name";E={$vm}},
        @{N="Cluster";E={Get-Cluster -VM $vm}},
        @{N="ESX Host";E={(Get-VMHost -VM $vm).Name}},
        @{N="Datastore";E={$_.Name}},
        @{N="DS Capacity GB";E={$_.CapacityMB/1KB}},
        @{N="DS Free GB";E={$_.FreeSpaceMB/1KB}}
}
$report | Export-Csv -NoTypeInformation C:\VM_CLuster_Host_Datastore.csv

And if you want some control the format of numbers, use the Round method

$vc = connect-viserver "eg VC name" $report = @()
foreach($vm in Get-VM){
    $ds = Get-Datastore -VM $vm    $report += $ds | Select @{N="Name";E={$vm}},
        @{N="Cluster";E={Get-Cluster -VM $vm}},
        @{N="ESX Host";E={(Get-VMHost -VM $vm).Name}},
        @{N="Datastore";E={$_.Name}},
        @{N="DS Capacity GB";E={[Math]::Round($_.CapacityMB/1KB,2)}},
        @{N="DS Free GB";E={[Math]::Round($_.FreeSpaceMB/1KB,2)}}
}
$report | Export-Csv -NoTypeInformation C:\VM_CLuster_Host_Datastore.csv

Tags: VMware

Similar Questions

  • Script of VM inventory for VM name with the location, the name of the Cluster and data storing total size and free space left in DS.

    Hello

    I wanted to collect script inventory VM VM name with location, name of the Cluster and data store total size and free space left in Datastore.I have script but his mistake of shows during its execution. Any help on this will be apreciated.

    Thank you

    VMG

    Error: -.

    Get-view: could not validate the argument on the parameter "VIObject". The argument is null or empty. Provide an argument that is not null or empty, and then try
    the command again.
    E:\script\VM-DS-cluster.ps1:7 tank: 20
    + $esx = get-view < < < < $vm. Runtime.Host - name of the Parent property
    + CategoryInfo: InvalidData: (:)) [Get-view], ParameterBindingValidationException)
    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-view: could not validate the argument on the parameter "VIObject". The argument is null or empty. Provide an argument that is not null or empty, and then try
    the command again.
    E:\script\VM-DS-cluster.ps1:8 tank: 24
    + $cluster = get-view < < < < $esx. Parent - the name of the property
    + CategoryInfo: InvalidData: (:)) [Get-view], ParameterBindingValidationException)
    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    Get-view: could not validate the argument on the parameter "VIObject". The argument is null or empty. Provide an argument that is not null or empty, and then try
    the command again.
    E:\script\VM-DS-cluster.ps1:9 tank: 24
    + += get-view $report < < < < $vm. Store data-name of the property, summary |
    + CategoryInfo: InvalidData: (:)) [Get-view], ParameterBindingValidationException)
    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.DotNetInterop.GetVIView

    It seems that your copy/paste lost some.

    I have attached the script

  • I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not download apps

    I am not able to download apps for my iPhone on the App Store. He just 'waiting '. But never starts the download. I tried with wifi and mobile data. The two are not downloading the applications Can u find out what's wrong? I use iPhone 5s

    I had the same problem. At the same time hold the screen lock button and the home button until your iPhone restarts. That solved the problem for me.

  • I paid for a year with the full creative cloud but can't find p´the program to download

    I paid for a year with the full creative cloud but couldn't findthe program to download

    To start https://helpx.adobe.com/creative-cloud.html the Cloud

    -Installation, update or uninstall and launching after installation

  • Check for multiple users with the value of the UID 0

    Hi gurus,

    The runclufvy.sh gives the warning below can I ignore this or need to fix for the installation of the 11202 RAC on RHEL 5?

    Check for multiple users with the value of the UID 0
    PRVF-4132: several users 'root, jnftsi0' with '0' the UID exists on "hwvpa6".
    PRVF-4132: several users 'root, jnftsi0' with '0' the UID exists on "hwvpa2".

    Thank you

    Hello

    The runclufvy.sh gives the warning below can I ignore this or need to fix for the installation of the 11202 RAC on RHEL 5?

    Check for multiple users with the value of the UID 0
    PRVF-4132: several users 'root, jnftsi0' with '0' the UID exists on "hwvpa6".
    PRVF-4132: several users 'root, jnftsi0' with '0' the UID exists on "hwvpa2".

    User jnftsi0 cannot be used by the Oracle Installer or start the Oracle process, because what is the root group.

    If the user jnftsi0 is used by Oracle install or start Oracle process should then be removed from the root group, otherwise you can ignore it.

    Kind regards
    Levi pereira

  • What is the problem with the virtual store for Journ.E

    What is with the virtual store?
    I have a screen wihte, I never see virtual store?
    I think the support is very very bad.

    No one becomes an answer on the question!

    I put t know why Toshiba need so much time to solve this problem.
    Unfortunately, we have to wait until it will be fixed. :(

  • "this identifier apple is still used with the app store - 3times deducted from my credit card.

    I am trying to connect to the iStore, but I receive the following message: "" this identifier apple is still used with the app store.

    I following the registration process, but nothing happened just 3times deducted from my credit card...

    I filled the fields are all required and still does not work, just my credit card losing ~ $7 Dollar (2.2 dollar every time with the following msg: ITUNES ITUNES.COM/BILL.) COM READ) I don't want to spend more money for a simple registration... Thanks for help.

    They are fresh from holding temporary store, your card issuer should remove in a few days or more: on the payment card's authorization in the iTunes Store - Apple Support

    A card having a chance to be accepted it must be registered with the same name and address (including the format and spacing etc) that you have on your iTunes account and have been issued by a bank in the country where you are (and, therefore, the country that sits on your iTunes account). If it is you can check with the card issuer to see if it is them who are in decline. Or do you have another card you could try?

    Or to create a new account without giving details of the payment: create an iTunes Store account, App Store and iBooks Store without credit card or other method of payment - Apple Support

  • This identifier apple has not yet been used with the App store.

    I bought my macbook pro to my brother and always used without my Apple ID and then I decided to restore the macbook to the factory because of some problems with the performance setting, when I hit install OS X Yosemite on the disk, it asks you to login Apple ID and when I try to login with my account , he says "this identifier Apple has not yet been used with the App store" Please check your account information, when I hit "see" nothing happens and it of kind of stuck and makes me restart the process and enter my apple ID and password. "

    I don't know what the problem is and now I can't open my macbook to use

    Because the computer has been configured using Apple ID of your brother, it is bound to this ID. If you have never downloaded Yosemite, you can not install it. Ask your brother to insert his Apple ID, so you can get the computer operational again. Then, go to the App Store, sign in with your ID and check the purchases tab to see if the Yosemite is an option. If this is not the case, download El Capitan and see if it will install. If you want to do a clean install, quit the installer and the program below allows you to create a bootable USB key. Boot from it, wipe the hard drive and then install El Capitan. When you restart normally it will be your computer. See also the link for sale.

    Bootable USB Flash Drive-Diskmaker X

    Sale of old Mac (4)          Apple support

  • Application loader stuck on "authentication with the iTunes store."

    I'm trying to submit my app via iTunes Connect. I was stuck on "authentication with the iTunes store" for more almost 20 min. Is this normal? Something wrong?

    Screen Shot 2014-09-10 at 9.09.24 PM.png

    I followed the Guide step by step Adobe publishing applications iPad and everything went smoothly thanks to the DPS App Builder. I was able to download both the app developer .ipa and distribution app .zip following the steps very well. But eventually, all measures are useless: interface of iTunes Connect has changed since the guide Adobe did, and now I'm completely lost.

    I downloaded the app Loader and try to submit this .zip app developer I have to iTunes Connect via the Application Loader. But in vain.

    Any help would be really appreciated. Thank you

    You can ignore this warning. You will, however, probably to encounter other errors. Please see http://status.adobedps.com/ for later.

    Neil

  • I just bought the last Apple TV - I can't seem to connect with the App Store and Siri is completely useless. This is an example of how Apple is unable to produce a useful product?

    I just bought the last Apple TV - I can't seem to connect with the App Store and Siri is completely useless. This is an example of how Apple is unable to produce a useful product?

    Hello

    Be sure to follow the instructions in this article to support > set up your Apple TV (4th generation) - Apple supported

  • Remote control/software Apple TV with the App Store problems

    Seems ridiculous that a Sept 2016 4th Gen apple TV purchase has the same problems of connectivity with the App store. Impossible to connect, or even choose App store, or spare parts offline, erratic, glitch and acts as a problem of distance, but seems to be a software problem or interface. Obvious corrections or ideas to stabilize or least to increase connectivity to app store with 4th Gen Apple TV/remote control?

    No problem of connectivity with a 4th getting Apple TV remote here... Sorry, you encounter this problem with it.

    See if there is something that will help that you haven't tried in this article to support > set up the Apple TV Remote - Apple supported application

  • Need help with script java folder level for silent registration with unique file name

    That's what I'm trying to do

    1. when a person completes the request on one of our computers in the office, there will be a button send at the bottom of the application.

    2 submit the application on is automatically stored on the local server with the file name determined by the fields name and surname on the application.

    example - John Doe Application.pdf

    Saved in the folder C:\Users\Station1\Desktop\FinishedApplication.jpgApplications

    3. This is the example of code I found, but I don't know how to enter which fields determine save name and where to save it to.

    http://thelivecycle.blogspot.de/2015/06/save-with-new-name-in-specified.html

    http://thelivecycle.blogspot.de/2015/06/save-with-new-name-in-specified.html http://thelivecycle.blogspot.com/2009/11/save-form-to-specific-directories-and.html

    Thank you!

    Lol this is the part that you need as a script to the folder level:

    var lcbSaveAs = app.trustedFunction (function (vDoc, vPath) {}

    app.beginPriv ();

    vDoc.saveAs ({cPath: vPath});

    app.endPriv ();

    });

    This is the code you use in your file:

    lcbSaveAs (, "/ C/users/specialisee1/Desktop/result /" + this.getField("FirstName").valueAsString + "" + this.getField("LastName").valueAsString + "Application.pdf");

    lcbSaveAs is the name of the function of trust.

    vDoc.saveAs is the Document object, call the saveAs method.

    I don't know what oDoc.SaveAs is, or where you got it.

  • Thunderbird stops for one minute with the symbol of the waiting and then returns an error message on a script does not? CAUSED: By McAfee

    Thunderbird stops especially when you write a message, displays the circle waiting and finally back with a message on a script does not properly. The choices are stop script or continue, the choice is obviously stop. It's embarrassing, I have set up with the same problem with XP on Thunrderbird and on Firefox and supposed to with Win 8.1 this would go, I was wrong. It is a standard installation of you bird, have not had the problem again with F'fox.

    Thanks for the info, I intend to replace McAfee but looks, as norton may have the same problem or a similar problem and is probably what is causing issues with XP. E machine XP will disappear but will have to solve on the new machine.
    Once again thanks for the info.

  • Cannot find a service record for vCenter service with the host name "IP address"

    After upgrading to vCenter native 5.5 to vSphere Client device everything works, but not all orders for PowerCLI.

    After a command gives me error under VMware vSphere PowerCLI 6.0 Release 1

    Get-TagCategory: 13.07.2015 16:50:48 Get-TagCategory could not find a service record for vCenter service with host name 10.x.x.x

    In Zeile:2 Zeichen:1

    + Get-TagCategory

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

    + CategoryInfo: ObjectNotFound: (:)) [Get-TagCategory], VimException)

    + FullyQualifiedErrorId: ViCore_InventoryServiceProxy_GetInventoryServiceInfo_NoVcRegistration, VMware.VimAutomation.ViCore.Cmdlets.Commands.Tagging.GetTagCategory

    does anyone have a solution or an idea for this problem?

    Best

    Marco

    I have exactly the same problem. Are there solutions yet?

    Best regards

    René

    Found the solution in the database (2127028).

  • Script not running task for all objects using the Get-Content cmdlet

    Hello

    For some reason when I run the code following the newspaper bundles are only being dumped for the first host in the hosts.txt file. I have a script that gets the bundles of paper for all hosts in a cluster and rename the cryptic file name to reflect the name of the host with good Luc. I could just use the script to get the beams to all hosts in the cluster, but there are times where I need just one or two hosts in the cluster. Can someone tell me what is the problem with the code below?

    $VC = Read-Host "Enter name vCenter.
    $varHost = get-Content "S:\Get-Logs\hosts.txt".

    ##Connect to VCenter
    SE connect-VIServer $VC - WarningAction SilentlyContinue
    #----------------------------------------------------


    {foreach ($ESX to $varHost)

    $destPath = 'S:\Get-Logs\Logs\$($ESX) ".

    If ((New-Item-chemin $destPath-ItemType répertoire-ErrorAction SilentlyContinue) - eq $null)
    {- New - path $destPath - directory - ErrorAction SilentlyContinue ItemType}

    Get - Log - VMHost $ESX - Bundle - DestinationPath $destPath


    }


    # Disconnect - VIServer
    Disconnect-VIServer *-confirm: $false
    The Script ##End

    Although it would be ideal for the log files should be renamed at this point I would be happy if the script would create a folder for each host listed in the text file and place the log file in each folder.

    Thank you

    The variable $ESX contains only a string, not a Name property.

    If you are referencing $ESX. Name will return nothing

Maybe you are looking for