get the names of Get-ScsiLun data store

Im stuck here...  Can anyone help me to get the names of data store for storage devices using the script below? My requirement is to get the naa (ConsoleDeviceName) address and the names of data store for each storage device.

$esxName = "esxsrv1".

$report = @)

Get-ScsiLun - VmHost $esxName - LunType "disk". %{

$row = "" | Select the host, ConsoleDeviceName, model, provider

$row.host = $esxName

$row. ConsoleDeviceName = $_. ConsoleDeviceName

$row.vendor = $_. Name of the vendor

$row.model = $_. Model

$report += $row

}

$report | Export Csv c:\Temp\results.csv - NoTypeInformation

Thank you very much, Kev - o

Try it like this

$esxName = "esxsrv1"

$dsTab = @{}
foreach($ds in (Get-Datastore -VMHost $esxName | where {$_.Type -eq "vmfs"})){
    $ds.Extensiondata.Info.Vmfs.Extent | %{
        $dsTab[$_.DiskName] = $ds.Name
    }
}

$report = @()
Get-ScsiLun -VmHost $esxName -LunType "disk" | %{

    $row = "" | Select Host, ConsoleDeviceName, Vendor, Model, Datastore    $row.host = $esxName    $row.ConsoleDeviceName = $_.ConsoleDeviceName
    $row.vendor = $_.Vendor
    $row.model = $_.Model
    $row.Datastore = &{
        if($dsTab.ContainsKey($_.CanonicalName)){
            $dsTab[$_.CanonicalName]
        }
    }
    $report += $row}

$report |Export-Csv c:\Temp\results.csv -NoTypeInformation

The script begins by creating a hash table where he maps the CanonicalName with the DatastoreName.

In the 2nd part of the script of the hash table is used to find the DatastoreName through the CanonicalName.

Tags: VMware

Similar Questions

  • get the history of use of data store

    When you go to the performance tab from a data store that you can see the allocation graph and space used on a range of time.

    How to access these statistics via powercli?

    Get-stattype-entity * does not return all the types of stat for data warehouses

    the point of this is I'm trying to script a report that shows the percentage of data in the last 7 days store

    for example, 80%, 81%, 82%, 82%, 82%, 83% and 83%

    A quick glance at my post called statistical data store

  • Relocation of the unusable VCenter Server after data store

    I needed to move the VCenter server only US planes of the DataStore has located on SAN1 to B data store located on SAN2 because we were retiring SAN1. After connecting directly to the VMhost which housed the vCenter Server VM, closing the vCenter Server and remove the vCenter Server inventory, I scoured data store A and moved the server vCenter to B data store directory. "After the copy is completed, I added the back inot inventory of vCenter Server, it works, toldi it"I moved"and received an error message indicating the file vCentersrvr.vmdk ' was absent.

    A review of the content directory for vCenter data store b shows no vCentersrvr.vmdk, but rather lists a file called vCentersrvr - flat hard. The type of file, the file is listed as "file". I tried to rename this gall and turn on/off the VM, but still no luck. Here are my questions:

    1. Can I save this installation? The original directory no longer exists (it was deleted automatically after the copy of the file).
    2. If I can't save this installation, can I just rebuild a new vCenter Server and Add (2) hosts that are currently managed by the vCenter Server server has failed?

    There is another method to recreate the descriptor VMDK files. http://www.phdvirtual.com/VMDKstubgenerator

  • View the number of paths and the political path for each data store

    Hi all

    Seem to be stuck on this one. and all that seems to be able to find through topis and scripts for the air path setting. All I have to do is list each data store to its policy of access road and the number of path for the data store on the host computer.

    I'm gussiing it uses the get-vmhoststorage cmdlet?

    Any help much appriciated.

    Phil

    Try something like this

    Get-VMHost | %{
         $esxImpl = $_
         $_ | Get-ScsiLun | where {$_.LunType -eq "Disk"} | %{
              $_ | Select @{N="HostName";E={$esxImpl.Name}},
              @{N="Path";E={$_.CanonicalName}},
              @{N="Policy";E={$_.MultiPathPolicy}},
              @{N="Number";E={($_ | Get-ScsiLunPath).Count}}
         }
    }
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • How to remove the virtual computer on a data store

    I'm moving VM (by the data store) to my new cluster data store and as I release a DS I have delete and create new with VMFS5.  I just emptied a data store but when I run the following command it shows again two VM on the same DS so when I navigate on the DS it is empty.

    Get-datastore-name "DS_NAME | Get - vm | FT name

    How to see where/how/why these two VMs are on the DS when it seems to be empty, and I'm assuming that PowerCLI is my best result. Of course, I don't want to just delete the DS as possible casue a problem with these virtual machines.  When I look at the settings them of each virtual machine they show that they are on a store of separate data and not that I'm trying to delete.

    Any help is appreciated

    Thank you

    Sean

    You can do:

    Notice-EEG-Id | Get-VIObjectByVIView

    or:

    Get - VM | Get-Datastore

  • Using several data stores, cannot migrate the vmx file in a data store

    I am host migration between 3.5 and 4.0, and part of the migration requires me to vmotion data to a single shared LUN data warehouses.  From there on, I import the virtual machine in 4.0 and using the script to migrate the two VM disks at different stores of data below.  The problem I have is that the configuration (vmx) file not migrated and is left on the shared storage LUNS.  Anyone knows how to go beyond this?

    The Script:

    $VMDisk = 'disk 1 '.

    $VMName = 'TestVM '.

    $TargetDS = get-Datastore - VMHost (Get-VMHost-$S.id Id) | Where-Object {$_.} Name - like "PMV"} | "" FreeSpaceMB tri-objet-descending | SELECT name - first of all 1

    $vm = get-View - ViewType VirtualMachine-filter @{"Name" = $VMName}

    foreach ($dev in $vm. Config.Hardware.Device) {if ($dev. DeviceInfo.Label - eq $vmDisk) {$diskId = $dev. Key}}

    $spec = new-Object VMware.Vim.VirtualMachineRelocateSpec

    $diskspec = new-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator

    $diskspec. Data store = (Get-Datastore-name $TargetDS.Name |) Get - View). MoRef

    $diskspec.diskId = $diskId

    $spec. Disk = @($diskspec)

    $task = get-View ($vm. RelocateVM_Task ($spec, "lowpriority"))

    OK, I think I understand your problem now.

    I fear that in the current construction of PowerCLI, the Move-VM cmdlet does not destinations of individual data for each virtual hard disk store.

    With the RelocateVM_Task method, it is possible.

    The following script moves a guest at 3 different data warehouses:

    -the. VMX file for DS2

    -hard disk 1 for DS3

    -hard drive 2 TB DS4

    $vmName = "MyGuest"
    $vmxDS = "DS2"
    $osDS = "DS3"
    $dataDS = "DS4"
    
    $vm = Get-VM -Name $vmName
    
    $vm.Extensiondata.Config.Hardware.Device | %{
         if ($_.DeviceInfo.Label -eq "Hard disk 1"){
              $osDiskId = $_.Key
         }
         elseif($_.DeviceInfo.Label -eq "Hard disk 2"){
              $dataDiskId = $_.Key
         }
    }
    
    $spec = New-Object VMware.Vim.VirtualMachineRelocateSpec
    
    $osRelocate = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator
    $osRelocate.Datastore = (Get-Datastore -Name $osDS).Extensiondata.MoRef
    $osRelocate.diskId = $osDiskId
    
    $dataRelocate = New-Object VMware.Vim.VirtualMachineRelocateSpecDiskLocator
    $dataRelocate.Datastore = (Get-Datastore -Name $dataDS).Extensiondata.MoRef
    $dataRelocate.diskId = $dataDiskId
    
    $spec.Disk = @($osRelocate,$dataRelocate)
    $spec.Datastore = (Get-Datastore -Name $vmxDS).Extensiondata.MoRef
    $spec.Host = $vm.Extensiondata.Summary.Runtime.Host
    
    $task = Get-View ($vm.Extensiondata.RelocateVM_Task($spec, "lowpriority"))
    while("running","queued" -contains $task.Info.State){
         $task.UpdateViewData("Info")
         sleep 5
    }
    

    BTW, you can use the cmdlet Set - hard disk to a virtual disk that is specific to a data store.

    But as I understood what is not possible in your environment.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Find the property of device a data store

    In the VI client when you view storage information, you see the Identification of the store of data and in the peripheral next column.

    This property of the unit is not available when you use Get-data store, is there a way to dig a little deeper and find? I need to list all my data warehouses and the information contained in this column of the device.

    Thank you

    Have a look at the script I gave in Get-datastore and ID LUN information.

    If you only want the name of DS and the device, you can use the below condensed version.

    function Get-DSDevice($dsImpl)
    {
              $ds = Get-View -Id $dsImpl.Id
              $esx = Get-View $ds.Host[0].Key
              $hss = Get-View $esx.ConfigManager.StorageSystem
    
              foreach($mount in $hss.FileSystemVolumeInfo.MountInfo){
                  if($mount.volume.name -eq $ds.Info.Name){
                   switch($mount.Volume.Type){
                   "VMFS" {
                        foreach($ext in $mount.Volume.Extent){
                             if($mount.volume.name -eq $ds.Info.Name){
                                  $device =$ext.DiskName + ":" + $ext.Partition
                             }
                        }
                     }
                   "NFS" {
                       $device = $mount.Volume.RemoteHost + ":" + $mount.Volume.RemotePath
                     }
                   }
                }
              }
         $device
    }
    
    $report = @()
    Get-Datastore | %{
         $row = "" | Select dsName, dsDevice
         $row.dsName = $_.Name
         $row.dsDevice = Get-DSDevice $_
         $report += $row
    }
    $report
    
  • Find the name of ref vm data center

    Hello

    When I get VmCreatedEvent I get new vm REF. During the recovery of new VMs property, I would find the 'name of the Datacenter". I'm not able to cross over from the VM to the data center. Can someone help me with this?

    I'm more trying traversal (vSphere SDK for Java):

    PropertySpec dcSpec = new PropertySpec();

    dcSpec.setType ("data center");

    dcSpec.setPathSet (new String() {"name"});

    hostPropSpec.setAll (false);

    SelectionSpec recurseParents = new SelectionSpec();
    recurseParents.setName ("parent2parent");
    TraversalSpec dcTraversalSpec = new TraversalSpec();
    dcTraversalSpec.setType ("VirtualMachine");
    dcTraversalSpec.setPath ("parent");
    dcTraversalSpec.setName (recurseParents.getName ());
    dcTraversalSpec.setSelectSet (new SelectionSpec [] {recurseParents});

    PropertyFilterSpec pfSpec = new PropertyFilterSpec();

    pfSpec.setPropSet (new [] {dcSpec} PropertySpec);

    pfSpec.setObjectSet (new [] {oSpec} ObjectSpec);

    return getService () .retrieveProperties (getContent () .getPropertyCollector (new PropertyFilterSpec [] {pfSpec}));

    It does not work.

    Thanks in advance.

    Hello

    I have the c# code for obtaining the name of ref. vm datacenter Here, I have explained how I got data center using vm ref in c#. I think it may useful allows you to get an equivalent in java.

    steps to follow:

    (1) download ref vm using the findbyip method by sending name datacenter as null.

    ManagedObjectReference VMObject is _service. FindByIp (_sic.searchIndex, null, clientIp, true);

    (2) get the vmparent as moref using getdynamicprop

    ManagedObjectReference vmParent is GetDynamicProp (ManagedObjectReference) (VMObject, 'parent');.

    (3) get the name of Datacenter as moref using getdynamicprop

    Data Center ManagedObjectReference = (ManagedObjectReference) GetDynamicProp (vmParent, 'parent');

    Let me know if you need an explanation of function getdynamicprop. I think it will be vijava CBC.

    Thank you

    Vijaya

  • Explosion of file size when the VM between moving/copying data store

    I just got my first setting dedicated the SAN unit in my ESXi infrastructure.

    I have set up and now my ESXi server got this new available data store.

    Initially, virtual machines when running on the local HDD SAS.

    I'm trying to move virtual machines between the 'old' DS to the new using the DS browser.

    When copy/moving of the unit of SAN iSCSI VMs to my HARD drive, I'm done with a HUGE vmdk file.

    Let's say that my original files are approximately 35 GB, when the process of copy/move this virtual machine to the no new DS, I get 250GB which is the size configured my virtual HARD disk...

    I'm I missing something here (obviously)?

    Any help/info would be greatly appreciated.

    Concerning

    Take a look at http://communities.vmware.com/message/1499444

    André

  • Notice-EEG - ViewType VM list only the virtual computer in a data store

    All, it seems to be confused about something that should be easy.  I guess it stems from a lack of understanding of Get - view.

    I'm changing the script of v3 vCheck virtu-al.  In it, he uses the line below to obtain the views of the virtual machine.  I want only the views of the virtual machine in a specific data store.  I was able to change the rest of the code, but I'm stuck here.

    $FullVM = get-View - ViewType VirtualMachine. Where {-not $_.} Config.Template}

    I tried: $FullVM = Get-Data Center & lt; Data CENTER & gt; Notice-EEG - ViewType VirtualMachine. Where {-not $_.} Config.Template} without success. Following error:

    Get-view: the input object cannot be bound to all the parameters of the command either because the command does not

    input pipeline or entry and its properties do not match any parameters that accept entries of pipeline.

    On line: 1 char: 25

    + $FullVM = $DC | Get-View & lt; & lt; & lt; & lt;  -ViewType VirtualMachine. Where {-not $_.} Config.Template}

    + CategoryInfo: InvalidArgument: (Server Management Denver: PSObject) , ParameterBindingExcepti

    on

    + FullyQualifiedErrorId: InputObjectNotBound, VMware.VimAutomation.Commands.DotNetInterop.GetVIView

    Any help would be appreciated, Josh

    Try this

    Get-View -Viewtype VirtualMachine -Searchroot (Get-Datacenter  | Get-View).MoRef
    
  • Connection to the AOP with several NIC data store

    I have a situation where I need to have the computer that is running the tiara to be connected to two different networks.  I have two NIC installed in the machine, NIC A and B NIC, we will call them.  The reason for this is that I use Diadem to access the server on a machine of AVL PUMA AO.  If I connect to the local network PUMA, PUMA sometimes breaks down, probably something to do with the IP address.  So PUMA has need to be on a network that is not a router.  My tiara computer must communicate with PUMA, as well as with local shared drives on our corporate network.

    In any case, I have the company LAN hung on A NIC and hung on NIC B PUMA network.  Tiara fails to connect when the two networks are connected, but connects to the data store no problem when that network PUMA is hung. Any ideas how to solve this problem?  It seems tiara is looking for NIC - A instead of NIC B, as appropriate.

    For reference, when the two NIC is connected, I can access other than readers, and separate computers to ping on both networks, without problem, is not a connection problem.

    Any help would be appreciated.

    -Russ

    I guess poth NIC have different IP.

    -Did you use IP instead of the server name.

    -Do you use RPC or CORBA to access the PUMA Server?

    -What version of DIAdem.

    You can create a log file when the connection has failed?

    Greetings

    Andreas

  • How to give more relevance to one of the column in multi-column data store

    Hi gurus,

    When using multi-column datastore necessary to give more importance to one of the other column. How can we achieve the same?
    SQL > create table test_sh4 (text1, text2 clob clob);

    Table created.

    SQL > alter table test_sh4 Add (Text3 clob);

    Modified table.

    SQL > start
    2 ctx_ddl.create_preference ('nd_mcd', 'multi_column_datastore');
    3 ctx_ddl.set_attribute
    4 ("nd_mcd",
    5 "columns."
    6 ' replace (Text1, "", "") nd, Text1 text1, replace (Text1, "", "') nd, Text1 text1');
    7 ctx_ddl.set_attribute ('nd_mcd', 'separator', 'new line');
    8 ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
    9 ctx_ddl.set_attribute ('test_lex1', 'spaces', ' /--------|-_ + "");
    10 end;
    11.

    PL/SQL procedure successfully completed.

    SQL > create index IX_test_sh4 on test_sh4 (Text3)
    indexType is ctxsys.context
    parameters
    ("nd_mcd of the data store
    lexer test_lex1')
    / 2 3 4 5 6

    Index created.
    Here, while querying how can I give more relevant for the text1 Text2 column as column?

    I gave an example below. I added some data to your example. You had tags and columns duplicated in your multi_column_datastore, so I fixed it those. I removed the newline delimiter and added a section with sections of field group and add this section to the index settings group. Allows you to search in each section of field and apply different fats. You can apply weights by multiplying by a value entre.1 and 10 or several times multiplier to reduce or increase the score for a particular section.

    SCOTT@orcl_11gR2> -- table structure you provided:
    SCOTT@orcl_11gR2> create table test_sh4 (text1 clob,text2 clob);
    
    Table created.
    
    SCOTT@orcl_11gR2> alter table test_sh4 add (text3 clob);
    
    Table altered.
    
    SCOTT@orcl_11gR2> -- added data:
    SCOTT@orcl_11gR2> insert all
      2  into test_sh4 (text1, text2, text3)
      3    values ('testword', 'word2', 'word3')
      4  into test_sh4 (text1, text2, text3)
      5    values ('word4', 'testword', 'word5')
      6  into test_sh4 (text1, text2, text3)
      7    values ('test word', 'word2', 'word3')
      8  into test_sh4 (text1, text2, text3)
      9    values ('word4', 'test word', 'word5')
     10  select * from dual
     11  /
    
    4 rows created.
    
    SCOTT@orcl_11gR2> -- fixed duplicate column names and tags and
    SCOTT@orcl_11gR2> -- removed newline delimiter and
    SCOTT@orcl_11gR2> -- added section group with field sections:
    SCOTT@orcl_11gR2> begin
      2    ctx_ddl.create_preference ('nd_mcd', 'multi_column_datastore');
      3    ctx_ddl.set_attribute
      4        ('nd_mcd',
      5         'columns',
      6         'replace (text1, '' '', '''') nd1,
      7          text1 text1,
      8          replace (text2, '' '', '''') nd2,
      9          text2 text2');
     10    ctx_ddl.create_preference ('test_lex1', 'basic_lexer');
     11    ctx_ddl.set_attribute ('test_lex1', 'whitespace', '/\|-_+');
     12    ctx_ddl.create_section_group ('test_sg', 'basic_section_group');
     13    ctx_ddl.add_field_section ('test_sg', 'text1', 'text1', true);
     14    ctx_ddl.add_field_section ('test_sg', 'nd1', 'nd1', true);
     15    ctx_ddl.add_field_section ('test_sg', 'text2', 'text2', true);
     16    ctx_ddl.add_field_section ('test_sg', 'nd2', 'nd2', true);
     17  end;
     18  /
    
    PL/SQL procedure successfully completed.
    
    SCOTT@orcl_11gR2> -- added section group to index:
    SCOTT@orcl_11gR2> create index IX_test_sh4 on test_sh4 (text3)
      2  indextype is ctxsys.context
      3  parameters
      4    ('datastore     nd_mcd
      5        lexer          test_lex1
      6        section group     test_sg')
      7  /
    
    Index created.
    
    SCOTT@orcl_11gR2> column text1 format a10
    SCOTT@orcl_11gR2> column text2 format a10
    SCOTT@orcl_11gR2> column text3 format a10
    SCOTT@orcl_11gR2> -- without weighting:
    SCOTT@orcl_11gR2> select score (1), t.* from test_sh4 t
      2  where  contains
      3             (t.text3,
      4              'testword',
      5              1) > 0
      6  /
    
      SCORE(1) TEXT1      TEXT2      TEXT3
    ---------- ---------- ---------- ----------
             6 testword   word2      word3
             6 word4      testword   word5
             3 test word  word2      word3
             3 word4      test word  word5
    
    4 rows selected.
    
    SCOTT@orcl_11gR2> -- with weighting:
    SCOTT@orcl_11gR2> select score (1), t.* from test_sh4 t
      2  where  contains
      3             (t.text3,
      4              '(testword within text1) * 10 or
      5            (testword within nd1)     *  5 or
      6            (testword within text2) * .5 or
      7            (testword within nd2)     * .1',
      8              1) > 0
      9  order  by score (1) desc
     10  /
    
      SCORE(1) TEXT1      TEXT2      TEXT3
    ---------- ---------- ---------- ----------
            48 testword   word2      word3
            20 test word  word2      word3
             2 word4      testword   word5
             1 word4      test word  word5
    
    4 rows selected.
    
  • How to reject records that are incompatible with the definition ODI 11 g data store?

    Buenas tardes.

    Como puedo girls los looking than any stupid fulfil the definition of length of atributos as hay in el data do not store? For example, in a process of integration llega a cuyo campo has a length of 50 characters first_name registro, pero base datos solo supports 40 characters. ODI in este falla y being the run y yo Necesito UN than rechace este registro y con continue the run. How I can control this event?

    Of photos muchas gracias.

    Hello

    Ah yes, I forgot about it.

    You can fool ODI by changing the logical length of the column in the data store in the model.

    In this way the I$ table will have a length of more than time and you won't have the problem.

    Kind regards

    JeromeFr

    PS: Your English is above the average on this forum, don't you worry. Most of us is not English-speaking.

  • Displacement of the VM attached to several data stores

    ESX 5.1.  I'm moving from one SAN to another.  I have a Windows VM file server that is attached to the "OS" data store which is 100 GB (for the OS, program installation, etc.) and the data store 'Data' that is 500 GB (where the file real stock data is stored).  On the new San, I created new warehouses of data, "New_OS" and "See you."

    What is the best way to move my data to the new data warehouses?  I know that I can use storage VMotion to move the virtual computer, but who will attempt to move the 'BONES' and 'Data' to 'New_OS' correct?  (Which of course will not work, since there is not enough space.)  I think that I have to remove 'Data' of the existing virtual computer, move it to 'See you' via a browser data store, move the computer virtual using VMotion, then add "you see?"  This sounds more complicated than it should be.  Am I missing something here?

    Thank you.

    Am I missing something here?

    Yes, it lacks the 'Advanced' option in Storage vMotion which will allow that move you each hard to a data store different... to do this, just follow the screens of Storage vMotion and select the data store, click on advanced and for each virtual hard disk and virtual machine configuration file, select the data store you want.

    Take a look at the documentation: http://pubs.vmware.com/vsphere-51/index.jsp#com.vmware.vsphere.vcenterhost.doc/GUID-A15EE2F6-AAF5-40DC-98B7-0DF72E166888.html

    Store the configuration of virtual machines and disks files in different places.

    one

    Click Advanced.

    b

    For the virtual machine for each virtual disk configuration file, select Browse and select a data store or cluster storage DRS.

    c

    (Optional) If you selected a cluster DRS for storage and do not use Storage DRS to this virtual machine, select Disable DRS storage for this virtual machine and select a store of data within the storage DRS cluster.

    d

    Click Next.

  • Rename the VM and labels in data store locations

    I remember my days with vSphere 4 x that I had to rename a virtual computer once.   But, the vmdk/vmx partner, files etc. and even the record in the data store has not changed.   However, when I did a Migration of vStorage in another store of data with the virtual machine also migrate to a new host when it was finished... all sync'd up.   or that's how I remember it.

    But, I'm now told my my virtual colleague that rename a virtual machine and to migrate to vStorage and VM migration to a new host WILL NOT synchronize the naming and lables.  is that correct?  I am almost sure that it worked in vSphere 4.

    It was behavior that was introduced in vSphere 5. It has since been resolved in Vcenter Server 5.0 Update 2 and 5.1 Update1. See the article I've linked below:

    VMware KB: vSphere 5.x Storage vMotion is not renaming the files of virtual machines at the end of migration

Maybe you are looking for