Script to list the information under Configuration/Storage/datastore details

Hello, I'm trying to create a script that returns the details data Configuration/Storage/Datastore/store info. The thing I want the script to do is list my ESX:s, data of list store names, list mpathpolicy and the details of the data store paths section in the VI client.

Is it possible to get this in a script? Or if anyone knows how I can get information from the info of paths in Details of the data store to the VI client

Thanks in advance

This is possible if you use the SDK.

The following script lists the name of host, name of DS, political path and the number of paths.

If you need other information on the page of details in the report let me know.

$report = @()

Get-VMHost  | Get-View | %{
     $esx = $_
     $esx.Datastore | %{Get-View $_} | where {$_.SUmmary.Type -eq "VMFS"} | %{
               $ds = $_
               $ds.Info.Vmfs.Extent | %{
                    $ext = $_
                    $extKey = ($esx.Config.StorageDevice.ScsiLun | where {$_.CanonicalName -eq $ext.DiskName}).Key
                    $lun = $esx.Config.StorageDevice.MultipathInfo.Lun | where {$_.Lun -eq $extKey}

                    $row = "" | Select ESXname, DSname, "Path Selection","Paths Total"
                    $row.ESXname = $esx.Name
                    $row.DSname = $ds.Name
                    $row."Path Selection" = &{
                         switch($lun.Policy.Policy){
                              "VMW_PSP_FIXED"{"Fixed"}
                              "VMW_PSP_RR"{"Round Robin"}
                              "VMW_PSP_MRU"{"Most Recently Used"}
                         }
                    }
                    $row."Paths Total" = $lun.Path.Count
                    $report += $row
               }
     }
}
$report

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • 12 Firefox just installed on MacBook Pro, OS x 106.8. FF looks great, seems faster too. BUT on the tab menu, the small triangle (to list the information on the tab) is missing;

    12 Firefox just installed on MacBook Pro, OS x 106.8. FF looks great, seems faster too. BUT on the tab menu, the small triangle (to list the information on the tab) is missing; I can't find a way to reinstall using view-> toolbars-> Customize option. Can you help me?

    You will see only the "List all tabs" button in Firefox 12 + if it has that many tabs open you get the scroll bar tab buttons appearing.

    Bug 714281 - show the tabs button only when tabs band overflows

  • Script to list the number of PO in a specific range of accounting code

    Helloo

    I need a script to list all PO numbers within a specific range of accounting code.  The script is used for the assessment of the stock.

    Grateful if someone can help.

    Hello

    Please, if this answer is late; just ignore it

    The following SQL select statement assumes that you know the costs/inv. natural accounts of valuation and natural account segment is 2:

    Select po_num, authorization_status, closed_code

    of PO_DISTRIBUTIONS_INQ_V one

    where destination_type_code = no ('STOCK', 'FEES')

    and a.code_combination_id in

    (select b.code_combination_id in the GL_CODE_COMBINATIONS_V b where segment2 = all ('170702110', '720201000'))

    "170702110", "720201000" are natural sample accounts

    Thank you

  • Change the PowerCLI Script to use the DRS and DRS storage

    Hello

    I have a PowerCLI script that specifies a host and a data store to create a new virtual machine, which has served us well. Now we have activated the DRS and DRS storage and I wonder what to change in order to take advantage of these features. Are there commands to specify a cluster and the cluster data store and let the DRS to decide the initial investment for a new virtual machine? At the moment we put all hosts and the warehouses of data as variables and use them in the line below.

    Thank you.

    $newVM = New-VM-name $NewVMname - VM $TemplateName Datastore - $datastore - VMHost $vHost - confirm: $false - location $myName

    You set a Datastorecluster?

    If Yes, then you can replace the value of parameter data with the datastorecluster object store.

    Replacing a VMHost with a cluster is not taken in charge I'm afraid.

    But you can use something like this

    New-VM-name TestVM Datastore - DSC - ResourcePool (Get-Cluster-name mycluster |) Get - Resourcepool - name of resources)

    This will automatically select the VMHost.

    The virtual machine appears in the root of the cluster.

    DSC is the name of a datastorecluster in the cluster mycluster

  • PowerCLI script to list the df - hl on all ESX hosts?

    Hi Expert,

    I have more than 100 esx host, and I need to list all the df - hl out for my report. Y at - it instead of connect on each esx host to get under output, powercli script that I can use to remove similar information?

    Size of filesystem used Avail use % mounted on

    / dev/sdaa2 20G 1.5 G 17G 8%.

    / dev/CCISS/c0d0p1 1.1 G 118 M 909 M 12% / Boot

    / dev/sdaa6 9.7 G 151 M 9.0 G 2% / Home

    / dev/sdaa7 9.7 G 151 M 9.0 G 2% / tmp

    / dev/sdaa5 9.7 G 317 M 8.9 G 4% / var

    / dev/sdaa8 494M 212 M 257M 46% /vmimages

    Please advice. Thank you

    Are you allowed to enable SSH on servers ESX (i)?

    And are you allowed to establish a SSH session on each ESX (i) Server?

    You have an account and a password on each ESX (i) server that can run the command 'df '?

    If it is Yes, then you can use something like plink.exe in consequence of PuTTY to connect to each ESX (i) server, run the command "df" and retrieve the output.

    There are several available examples to use plink.

    And don't forget that you will need a fingerprint for each server ESX (i) will be stored on the client from which you are running the script.

  • Newbie question: show all files under Configuration == > storage?

    Hello

    I have been using VMware workstation for awhile, but at work, we have been 'given' an ESX instance for development which access us via Vcenter.

    From the workstation, I am not so familiar with this environment, so I hope I write at least in an appropriate place ...

    Anyway, my question is that when I'm in Vcenter and go to the Configuration tab, then storage (left) to see what is different volumes, I * think * that it shows all files.  For example, if I have a VMDK, it is to show only the VMDK root and not the flat file.  I know that because we've created a guest with a 50 GB disc, and when we downloaded "the VMDK", we ended up with the smallest hard, as well as the largest flat hard-xxx.

    As I said I'm more use on my computer, where I have full access to the underlying files, so it takes some time to get used to this environment.

    The reason for the question is that I'm used to things like manually copying my base VMDK files when I create my own clones, but since with Vcenter, I can't 'see' all the vmdk, I kind of don't know what I'm doing deal with.

    I hope this makes sense?

    Thank you

    Jim

    Difference between VMDK and Flat.VMDK.

    VMDK is a discriptor file mapped to raw disk (flat.vmdk).

    Flat.VMDK is a raw disk where all system data is backed up.

    For example, you create any disk on a virtual machine you will get 2 files one is vmdk and another is flat.vmdk.

    VMDK are visible when you go to the configuration and storage tab and browse the data store and will not be displayed it default flat.vmdk.

    But a raw disk, you can see when you connect console esxi ot via putty and go to vmfs\volumes\VM name\ flat.vmdk.

    When you download, you will be able to download vmdk and flat.vmdk. If you download only vmdk on the navigation data store.

    Award points if the answer is useful or appropriate by clicking the sub tab.

  • How to make the information in configuration file of Windows 7 host environment virtual xp?

    I recently installed virtual PC and virtual XP on my new machine windows 7 so that I can run some visual basic 6.0 programs there. I have some files of actual data on the c: drive of the windows computer 7 which visual basic programs are unable to find. How can I contact configuration of the file information in the enviironment virtual xp? Are there good reference books or articles about this kind of thing?

    Dick to Dallas

    Hey Dick,

    Thanks for posting your question in the Microsoft Community forums.

    The description of the problem, I see that you have a problem with access to some files when using Windows XP Mode.
     
     
    Don't worry; We are here to help and guide you in the right direction.

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.

    http://social.technet.Microsoft.com/forums/en/w7itprovirt/threads

    Hope this information helps you. If you need additional help or information on Windows, I'll be happy to help you. We, at tender Microsoft to excellence.
  • PS The Script to list the sizes (complete and used) of vmdk (slim type)

    Hello

    I'm looking for a way to list to each vmdk which are thin format, maximum and used size. In fact, I saw that we have information by the data store (VMware.Vim.VirtualMachineUsageOnDatastore, with other files as swap, cliché...), but I need by vmdk. Does anyone has an idea (it is possible)?

    Thank you

    See the to find the actual size of the VM disks post.

  • Script to list the responsibility of the user by Department

    Hello

    I'm looking for a script that can list all employees and responsibilities, as well as his Ministry. I want to output something like this:

     
    
    _Name_                                _Responsibility_                                                  _Application_               _Department_
    
    Peter Ken                          Fixed Assets Manager                                            Assets                          Finance
    I'm on 12.1.1

    Dula

    Please take the necessary haou table columns.

    SELECT   paf.full_name,
             paaf.assignment_id,
             fr.responsibility_name,
             furg.start_date,
             fat.application_name,
             haou.*
        FROM fnd_user_resp_groups_direct furg,
             fnd_user fu,
             fnd_responsibility_tl fr,
             per_all_people_f paf,
             fnd_application_tl fat,
             hr_all_organization_units haou,
             per_all_assignments_f paaf
       WHERE furg.user_id = fu.user_id
         AND furg.responsibility_id = fr.responsibility_id
         AND fu.employee_id = paf.person_id(+)
         AND fr.application_id = fat.application_id
         AND fr.LANGUAGE = USERENV ('LANG')
         AND fu.user_name = '&user_name'
         AND paf.person_id = paaf.person_id
         AND haou.organization_id = paaf.organization_id
         AND trunc(sysdate) BETWEEN nvl(paf.effective_start_date,trunc(sysdate)) AND nvl(paf.effective_end_date,trunc(sysdate))
         AND trunc(sysdate) BETWEEN nvl(paaf.effective_start_date,trunc(sysdate)) AND nvl(paaf.effective_end_date,trunc(sysdate))
    ORDER BY 3 DESC
    

    HTH
    See you soon,.
    ND
    Use the buttons "useful" or "correct" to award points to the answers.

  • Need a script that lists the VM with a snapshot

    Hello

    I am relatively new to powershell scripting and even newer to the vSphere CLI. I have no problem reading and understanding scripts, but what makes one is another story. In any case, I'm looking for help to create a script that will check that all the vm's on all ESX hosts, if they have a snapshot and if they echo the name of the virtual machine to the screen.

    That's what I have so far but I'm stuck and probably on the wrong track. Any help/suggestions are welcome!

    $user = "< removed >.
    $passw = "< removed >.
    $VIServers = "< IP ESXi host >", "< IP ESX Host1 >', '< IP ESX Host2 >', '< IP ESX Host3 >', '< IP ESX Host4 >', '< IP ESX Host5 >', '< IP ESX Host6 >.

    {foreach ($VIServer to $ViServers)
    SE connect-VIServer-Server $VIServer - user $user-password $passw
    $vms = get-vmhost $VIServer | Get - vm

    {foreach ($vm to $vms)
    < code that checks to see if there is a snapshot and echo is the name of the virtual machine to the screen. Clueless >

    }
    }
    }

    Forward thanks!

    Kind regards

    Erik

    Why directly to the ESX: you?... To connect to vCenter instead and then it s very easy...

    Get - VM | Get-Snapshot | Select the virtual machine, name, Description, created. Kind created

    Kenth-

  • Is there a process or program that I can use to restore the system and configuration of the system to the original

    Hello

    I would like to know if there is a microsoft tool or a suggested list of Microsoft that could help me restore the system and the system configuration files in the appropriate State. is not the restoration of the system. I don't know of retoring my computer to an earlier time, nor on the restoration of computer purchase. 

    I thought that my computer has been compromised in some way, and the intruder was accessing my unit via some sort of connection distance.

    I received the support of the malicious software company, and I think that my computer is fine now.

    And so the question with which I opened this post: I would like to know if there is a Microsoft tool or a suggested list of Microsoft that would help me to restore the system and the system configuration files in the appropriate State. I'm not taling about system restore. I speak not of retoring my computer to an earlier time.

    Whenever I start to notice the strange behaviour of my computer, I would like to launch this program and follow this procedure to reset all the settings and files to a suitable State. The reason why run alone to detect malware problems, and that if there is remote access to my computer inadvertently, the intruder can do a lot of editing of files which is not identified by the malware. and I believe that if I was able to run a program like this, all the changes took place, which expose my device, but the rules of behavior systems can be reversed for a proper state.

    I read an article on how to repair my operating system, but it forced me to get a copy of it; However, given that the supplied operating system with preinstalled on this computer, I could not follow the instructions. Article I read to all system and configuration files that meet the standards of the manufacturer, without losing files and installed programs.

    Thank you

    Hello

    Already, you mention that you can do; either a repair installation.

    "How to do a repair installation to repair Windows 7"
    http://www.SevenForums.com/tutorials/3413-repair-install.html

    And make sure that read you all the information under 'warning'.

    It also tells you what drives you can and cannot use to do.

    ________________________________________________

    You can use this to fix the corrupted system files.

    "Command SFC/scannow - System File Checker.

    http://www.SevenForums.com/tutorials/1538-SFC-SCANNOW-Command-System-File-Checker.html

    «Use the System File Checker tool to repair missing or corrupted system files»

    http://support.Microsoft.com/kb/929833/en-us

    But if SFC detect serious errors in the file system, you may need to do a repair installation as in the instructions in the first part of this answer.

    See you soon.

  • Script to list all bookmarks in top/Parent not bookmarks Sub

    Hello

    Can someone advise please how to modify the following script, which lists the tree entire bookmark list on the contrary all bookmarks in high level and not bookmarks under?

    This is the script that I used that lists all bookmarks.

    / * All bookmarks in the list * /.
    / * Work recursive l‟arbre bookmark * /.
    function PrintBookmarks (bm, nLevel)
    {
    If (nLevel! = 0) {/ / do not print the root}
    bmReport.absIndent = bmTab *(nLevel-1);
    BM. Execute();
    bmReport.writeText ("(page #) ' + (bm.doc.pageNum + 1) +" "+ bm.name");

    }
    If (bm.children! = null)
    for (var i = 0; i < bm.children.length; i ++)
    PrintBookmarks (bm.children [i], nLevel + 1);
    }
    bmTab = 20;
    bmReport = new Report();
    bmReport.size = 2;
    bmReport.writeText (this.title);
    bmReport.writeText("");
    bmReport.size = 1.5;
    bmReport.writeText ("list bookmarks");
    bmReport.writeText("");
    bmReport.size = 1;
    PrintBookmarks (this.bookmarkRoot, 0);
    global.bmRep = bmReport;  do global
    global.wrtDoc = app.setInterval)
    "Try {'} '.
    +' reportDoc = global.bmRep.open ("list bookmarks"); "
    "+' console.println ("open Executed");"
    + "app.clearInterval (global.wrtDoc);"
    +' delete global.wrtDoc;'
    "+' console.println ("App.clearInterval Executed");"
    + "reportDoc.info.title = 'Bookmarks lists';"
    + "reportDoc.info.Author ="Bookmark Sequence list";"
    {+'} catch (e) {console.println ("Meanwhile...:" + e) ";}"}
    (100);

    Any help will be most appreciated.

    Use the PrintBookmarks function:

    If (bm.children! = null & nLevel == 0)

  • I recently had to replace my iPhone 6.  I can't store contact information, such as names and phone numbers.  I enter all the information and click Save.  Then go back and contact is not there

    I can't store the information under telephone contacts.  I enter information and press on save, but go back and contact is not there

    Is - this with iOS 5.0.1 and 4 s?

  • List the contents of a cluster VM group in a DRS Rule

    Hello

    I'm looking for a script that lists the contents of a cluster VM Group in a rule of DRS.

    Example: we have a single cluster vmware 'CL-TEST' DRS 2 'GP1 and GP2' groups that contain several virtual machines.

    We want to export the content of each group of DRS in an excel file.

    Any idea?

    Thank you

    Concerning

    Take a look to get a list of virtual machine is in a group of virtual machine DRS

  • For the information of the BIOS and Firmware. of PowerCLI

    Hi all

    Can anyone please share a PowerCLI script to get the information on all hosts in vCenter below?

    1 version of the BIOS

    2. date of the BIOS

    3 the firmware version

    4. date of the firmware

    I have this but it shows that for a single server and only the details of the BIOS. I want to all hosts in the vCenter.

    $VMHost = Get-VMHost 'Server01' | Get-View
    $VMHost.Hardware.BiosInfo
    
    

    Thank you

    Nick

    To run this for multiple ESX (i) servers you can do

    Get-view ViewType - HostSystem | Select the Name,@{N="BIOS version"; E={$_. Hardware.BiosInfo.BiosVersion}},
    @{N = "Date of the BIOS"; E={$_. Hardware.BiosInfo.releaseDate}}

    Note that the presence of these values depends on the HW you use.

    There are several types of HW from different vendors who do not properly fulfill these values.

    Not sure what you mean with the properties of the firmware.

    These appear in the vSphere Client?

Maybe you are looking for