In need of a script to the inventory of the virtual computer on data warehouses

I analyzed vCheck by www.virtu-al.net. Great script and I can learn a lot of information that I need. However, I am a newbie to script and is looking to add a piece that I need inventory of data warehouses.

That's what I need:

I need an inventory of VMS on each cluster and have it store data that they are on a report. It would happen every night and I would be delighted if it had exported to a html file which can be downloaded to an internal wiki. I love the output html of the vCheck tool and would like to add this piece to the tool, so that it is brought to the same html file.

Does anyone know if there is a script that will help me to do?

Thank you!

No problem, happy, I can help you

This will include the ESXi host.

To sort the list, we have everything first to grasp objects in an array and then sort.

$result = @()
foreach ($Cluster in $Clusters){
   $result += (Get-VM -Location $Cluster | Get-HardDisk |
   Select @{N="Cluster";E={$cluster.Name}},
     @{N="Host";E={$_.Parent.Host.Name}},
     @{N="VM";E={$_.Parent.Name}},
   @{N="Datastore";E={$_.Filename.Split(']')[0].TrimStart('[')}})
}
$result | Sort-Object -Property VM

Tags: VMware

Similar Questions

  • simple script for the list of all data warehouses properties

    I searched a lot of scripts to get information about my data stores. I can quickly export most the properies of that I need right to a csv file vCenter. A flagrant lack room is the 'space Proviosoned' display of list of data store. I look at the properties of each data store to see this information. Y at - it a script that can get this information?  For this script, I don't reallt care about the news at the virtual machine level.

    Until they solve this problem, you can use something like this

    Get-Datastore | where {$_.Type -eq "VMFS"} | Select Name,
           @{N="Status";E={$_.Extensiondata.OverallStatus}},
           @{N="Device";E={$_.Extensiondata.Info.Vmfs.Extent[0].DiskName}},
           @{N="Capacity";E={"{0:f2} GB"-f ($_.CapacityMB /1KB)}},
           @{N="Free";E={"{0:f2} GB"-f ($_.FreeSpaceMB /1KB)}},
           @{N="Provisioned";E={"{0:f2} GB"-f (($_.ExtensionData.Summary.Capacity - $_.ExtensionData.Summary.FreeSpace + $_.ExtensionData.Summary.Uncommitted) /1GB)}},
           @{N="Type";E={$_.Extensiondata.Info.Vmfs.Type.ToLower() + $_.Extensiondata.Info.Vmfs.MajorVersion}},
           @{N="Last Update";E={$_.Extensiondata.Info.Timestamp}}
    
  • need to reconfigure the virtual computer after deployment of the vm

    Hi all

    I have a script to deploy a computer virtual to a CSV file. I need to change the configuration of virtual machine (CPU and memory) after the deployment of the vm. where the name of the virtual machine should be taken to csv. So any help is appreciated.

    Attach the script used. (downloaded and works fine)

    $vms = import-CSV D:\vm-deploy\vm-deploy.csv

    {foreach ($vm to $vms)

    $Template = get-model $vm.template

    $VMHost = get-VMHost $vm.host

    $Datastore = get-data store $vm.datastore

    $OSCustomization = get-OSCustomizationSpec $vm.customization

    New-VM-name $vm.name - OSCustomizationSpec $OSCustomization - VMHost - $VMHost model $Template - $Datastore - Datastore RunAsync

    }

    # This cmd need to run after the vm deployment completed. The virtual computer name must come from the 1 column of the CSV file

    Set-VM $vmname - NumCpu 2 - MemoryGB 5 - confirm: $false

    Write-Host "All VMs deployed" - ForegroundColor Green

    Disconnect-VIServer-confirm: $false

    CSV file looks like this

    Name, host datastore, Template, customizing

    Test-VM,vm-dep-test,ESX02,P5-vm-stage,vm-deploy

    Thanks in advance...

    A simpler, but not optimal, solution is to use the Wait-job cmdlet.

    Something like that

    $vms = import-CSV D:\vm-deploy\vm-deploy.csv

    $tasks = @)

    {foreach ($vm to $vms)

    $Template = get-model $vm.template

    $VMHost = get-VMHost $vm.host

    $Datastore = get-data store $vm.datastore

    $OSCustomization = get-OSCustomizationSpec $vm.customization

    $tasks += new-VM-name $vm.name - OSCustomizationSpec $OSCustomization - model $Template - VMHost $VMHost '

    Data - $Datastore - RunAsync store

    }

    Waiting-task-task $tasks

    {foreach ($vm to $vms)

    $vm.name set-VM - NumCpu 2 - MemoryGB 5 - confirm: $false

    }

  • Need to include the hardware version of the virtual computer in 'standard' VMReport.ps1 in Excel...

    Need to include the hardware version of the virtual computer in 'standard' VMReport.ps1 in Excel...

    Notice-EEG - viewtype virtualmachine. Select Name, @{N = "HardwareVersion"; E = {'Version $($_.) Config.Version)"}}

    I above for the hardware version of vm, but I need to include in a report 'necessary' as 'necessary '.

    The script of VMReport.ps1 previously published works for all requirements except the hardware version of the virtual machine. I tried to 'embed' the syntax get-view without success.

    Any suggestions on how to get the VM hardware version (and the name of vm State, OS, CPU, IPAddress, host) in an excel spreadsheet?

    I have VDuc script is modified for the rest no problem.

    All points will be awarded as usual.

    Hello

    You can try below also extracts

    $report = @()
    
    Get-VM | %{
        $row = "" | Select VMName, State, OS,  Host, CPU, IPAddress, HWVersion
         $Ver = $_|get-view
         $vmGuest = $_ | Get-VMGuest
         $row.VMname = $_.Name
         $row.HWVersion= $Ver.Config.Version
         $row.IPAddress = $vmGuest.IPAddress[0]
         $row.Host = $_.Host.Name
         $row.OS = $_.Guest.OSFullName
         $row.State = $_.PowerState
         $row.CPU = $_.numcpu
         $report += $row
    }
    $report | Export-CSV c:\VMReportTest1.csv
    

    I hope this helps.

  • do you need a power supply to the current entry with data acquisition or 9265

    Hello I just receive the NI 9265 Daq for research in my lab. I'm trying to present entry and display it on an oscilloscope. I don't get anything. I did some research on the internet, so my question is do you need a power supply to the current entry with data acquisition or 9265?

    Read the data sheet.  Clearly on the first page is a sentence which reads "the NI 9265 requires 9 V to 36 V external power.

  • You will need to activate CS2 on the second computer, but no longer have the serial number.  How?

    You will need to activate CS2 on the second computer, but no longer have the serial number because this copy was a replacement for original who has trashed when the hard drive crashed.  How can I do this?

    Error message: activation not available server | CS2, Acrobat 7, pass a hearing 3

    Only works on Windows or old Mac PowerPC. Modern MacIntel cannot run CS2.

  • Script to rename the virtual computer by name DNS listed in VC

    I am very new to powershell, and I tried to understand this by using pieces of code I found, but nothing helped.

    I'm looking for a script to take the given DNS host name for a virtual machine listed in VCenter and rename the virtual computer.

    For example.

    Host01VM01 (as shown in Vcenter) - the DNS name of the "something.xyz.com".   VM and rename it "something.xyz.com" in Vcenter.

    To run the script only for a group called "Mycluster" you can do:

    Get-Cluster "My Cluster" | Get-VM | `
    Where-Object { $_.Guest.HostName } | `
    ForEach-Object { Set-VM -VM $_ -Name $_.Guest.HostName -Confirm:$false }
    

    This script will only work for VMS that have installed VMware tools and probably only for VM which are turned on.

  • Move-vm can migrate a powered off the virtual computer to a DRS cluster?

    When I try to move-vm has propelled off VM to a destination of DRS cluster, he says that he cannot migrate a powered off the virtual computer to a DRS cluster.   I can explicitly name the destination of the host and it works, but that defeats the purpose of using the DRS and forces me to script on the destination hosts.

    I do something wrong or I would be able to migrate a powered off the virtual computer to a DRS cluster?

    Thank you

    -MattG

    Hello, MattG-

    I get the same behavior as you when you try to move a VM PoweredOff to a DRS cluster, specifying the cluster as the value for the parameter - Destination to Move-VM (using PowerCLI v5.1 Rel 2 v5.5 Rel 1).  Not quite what I expected.

    To work around the problem, and without having to appoint a particular host as destination, you could use some Get-Random, do something like:

    Move-VM myVM0 -Destination (Get-Cluster myDestDRSCluster | Get-VMHost | ?{$_.State -eq "Connected"} | Get-Random) -RunAsync
    

    Who should receive the machine said cluster and on a host that is in the connected state.  A subsequent operation to the market (whenever do you eventually) should then see DRS power on the virtual machine on a suitable host in the cluster.

    Maybe the dev team can comment if this behavior is the expected or desired.

    Anyway, how does do for you?

  • How can I type of NETWORK adapter in the virtual computer a vCloud?

    I'm trying to write a script that compares the type of NETWORK card in vCloud NIC type in vCenter to work around a bug in vCloud 1.5.  I can get the type of NETWORK adapter in the virtual computer a vCenter by getting the vCenter VM up and running:


    $vcvm | Get-NetworkAdapter | FT-auto
    Name Type NetworkName MacAddress WakeOnLanEnabled
    ----              ----           ----------- ----------        ----------------
    Network adapter 1 isolated EnhancedVmxnet 00:50:56:01:00:33 True


    I do not get the same results when you perform an action similar to vCloud:
    $vcdvm | Get-CINetworkAdapter

    Connected primary index IPAddressAllocation IPAddress ExternalIPAddress VM
    ----- ------- ---------  ------------------- ---------       ----------------- --
    0 true true manual 192.168.10.30 nic1

    I can get all the other info NIC, such as the network, IP, MAC, etc, but not the type:
    ($vcdvm. ExtensionData.section) [2] .networkconnection

    Network: isolated
    NeedsCustomization: false
    NetworkConnectionIndex: 0
    IP address: 192.168.10.30
    ExternalIpAddress:
    IsConnected: true
    MACAddress: 00:50:56:01:00:33
    IpAddressAllocationMode: MANUAL
    Get_anyattr:
    VCloudExtension:

    For the moment, I get the type of NIC the vCloud himself database vCloud.  Thanks for any help.

    I use VMware vSphere PowerCLI 5.1 Release 1 build 793510

    I could tell you where to find it, but there is a bug in the API that shows only as PCNET32 anyway (sleep if she could be VMXNET3). Keep doing what you're doing with the database query.

    See you soon,.

    Jake

  • Best method to deploy the virtual computer

    Anyone who can tell me what is the best way to deploy the virtual computer deploy of the FVO or models (the VM creation) that create the virtual machine of the templated took longer time compare to the creation of the FVO. Any Suggestions?

    Deploying the model customizze the new machine as part of the deployment will treat you while FVO will be an exact xopy, so you need to manually configure the new machine.

  • Strange problem after moving from the virtual computer to a new data store

    I am migrating our VM existing (8 in total) a 'problem' RAID to a new table on a new controller and am having a strange problem. Here are the steps I took (host OS is Ubuntu 8.0.4 LTS x 64):

    (1) off the power the virtual computer from the Web interface

    (2) the directories created for each virtual on the new RAID array computer (in this case a RAID 10 array on LSI 9750-8i controller)

    (3) rSync used to copy the data from RAID1 to be RAID2

    4) has created a new data store on the new RAID through the Web Server of VMWare user interface.

    (5) removed VM of the inventory through the Web, their return, added user interface then choose files .vmx on new data store on RAID2

    They have all power save fine... but three of them are not accessible on the network. I can open a console in the Web Server of VMWare user interface and they all run normally... but I can't their ping or access the respective virtual machine Web GUI. It seems quite arbitrary that those who work and those who are not. In this case... the VM that don't work is a license Autodesk, a Squid proxy server and a VM of cactus. All three of these virtual machines are 32-bit Ubuntu Server VM (two 8.0.4 and a 10.0.4)... and are the only Ubuntu VM on this host. It must be signifigant but I'm not see how.

    If I delete these three virtual machines of the inventory again and add to their original location (on the RAID1) they light up AND work normally. A consultant that we were working seemed surprised, as he had also done this experiment with some of the older VMWare products. I don't see how it would be the physical location of the files of the virtual machine. Any ideas?

    We rely on the migration to ESXi soon but in the meantime, we get these a few VM out of this RAID array problem. I'm stuck.

    Depending on the application, it may be enough to reconfigure the IP parameters (they are very probably on DHCP now) for the newly detected virtual NIC.

    André

  • Get the IP address of the virtual computer? (when no DNS available)

    I have a strange setup where I have a server vCenter runs in a private network that has no DNS available IN-HOUSE.  I am running the scripts that query an IP address range, but takes forever to run.  I can run get - vm and get all virtual machines, but can't do anything with them because there is no DNS and I can't find a way to enter the IP address of the virtual computer.  If I could get the IP addresses I could then run functions against them.  If it makes a difference those VMS have two network cards: Public and private.  Any ideas?

    The Get - VM cmdlet returns the IP addresses to the title of Guest.IPAddress count of the first IP address use as well:

    Get-VM |Where {$_.PowerState -eq "PoweredOn" } |foreach { Write "$($_.Name) has an IPAddress of $($_.Guest.IPAddress[0])" }
    

    If you found this information useful, please consider the allocation of points for correct or helpful.

    Alan Renouf

    http://Virtu-al.NET

  • After the Virtual Machine is hot migrated lose the reference to the virtual computer object (VMware.Vim.VirtualMachine)

    Hello

    In my VB.Net application, I retrieve the virtual computer object (VMware.Vim.VirtualMachine) through scripting Powershell VI.

    If the Virtual Machine is migrated to another host (hotmigrate) I receive an event (VMware.Vim.VmMigratedEvent), which also holds the moref of the Virtual Machine. I tried to use the updateview method to refresh the virtual computer object but failed with an error message stating that the object could not be found, or never existed.

    I also tried to recover the virtual computer object again, throug the method Client.GetView and the moref returned by the event, but the same error message.

    How can I get my hands on the virtual computer object or update after migration to another host takes place. I have to get it back again? It would be great if I could do it somhow with information from moref I hold the event!

    Any help is appreciated!

    Concerning

    Manfred

    Sorry, but I can only show you how to do this in PowerShell.

    I use the purpose of the task to get to the prompt MoRef.

    Here's how:

    $vmName = 
    $tgtHost = 
    $tgtPool = 
    
    $vm = Get-VM $vmName | Get-View
    $poolMoRef = (Get-ResourcePool $tgtPool | Get-View).MoRef
    $esxMoRef = (Get-VMHost $tgtHost | Get-View).MoRef
    
    $task= Get-View ($vm.MigrateVM_Task($poolMoRef, $esxMoRef, "lowPriority", "poweredOn"))
    
    while($task.Info.State -eq "running" -or $task.Info.State -eq "queuing"){
      $task.UpdateViewData()
    }
    
    $vmImpl = Get-VIObjectByVIView -MORef $task.Info.Entity
    

    I don't know how you get at the VmMigratedEvent event, but the MoRef in there is pointing to the correct prompt.

    In the following script, I extracted all the events related to the task of vMigrate immediately after the vMigrate task finished

    function Print-VmName{
         param($event)
    
         $MoRef = New-Object VMware.Vim.ManagedObjectReference
         $MoRef.Type = $event.vm.vm.type
         $MoRef.Value = $event.vm.vm.Value
         $vm = Get-View $MoRef
         Write-Host $vm.Name
    }
    
    $events = Get-VIEvent -Start (Get-Date).addminutes(-15)
    $events | % {
         $event = $_
         $eventType = $_.GetType().Name
         switch ($eventType){
              "VmMigratedEvent" {
                   $eventType
                   Print-VmName $event
              }
              "VmEmigratingEvent"{
                   $eventType
                   Print-VmName $event
              }
              "VmBeingHotMigratedEvent" {
                   $eventType
                   Print-VmName $event
              }
              "TaskEvent" {
                   $eventType
                   Print-VmName $event
              }
         }
    }
    
  • Is it possible I can get the virtual computer connectivity after restart to connect to the local network in the host operating system?

    Hi all

    For some reason, I have to disable and then enable the LAN connection in the host operating system. If some virtual machines are running during this time, connectivity all VMs for out-of-world are lost, they cannot connect to the host even more (by running the ping command). I tried a few methods to retrieve the connectivity, but all have failed, for example,

    1. reboot the virtual computer

    2. restart VMware Workstation

    3. restart the corresponding system services in the host operating system

    The only way I can retrieve all is to restart the host operating system itself.

    Yes, is there short any path, I can retrieve the connectivity of these virtual machines?

    Thanks in advance.

    Yark

    yarkwang wrote:

    I use a Broadcom NetLink (TM) Gigabit Ethernet NIC, shows the date of the pilot 2006-5-15, but it works well, I think.

    Try installing a newer driver.  According to the site, you should be able to find a driver dated 2008 or 2007 (depending on which exact model of NetLink card you have):

    - http://www.broadcom.com/support/ethernet_nic/downloaddrivers.php

    1 came out of safe guard 360

    Sometimes out of some firewall programs is not enough (they keep still themselves installed in the network of the host stack, even if they are 'closed').  You may need to uninstall to make sure that it is not interfere.  (Search the forums for support for your firewall software see if anyone else is having problems with vmware and 360 safe guard).

  • ESX host managed by VirtualCenter servers all see the same SAN LUNS / data warehouses

    Scenario of

    I have two separate deployments of VirtualCenter (in the same physical location) VCA and VCB with each deployment management 5 x ESX hosts (10 in total).

    All 10 hosts are allowed to look at the same SAN LUNS / data warehouses?

    Or I have to isolate five VCA hosts and five guests to their own SAN LUNS VCB / data warehouses?

    Box293 wrote:

    Basically, we have our direct environment and we are on the beta program for VI4.

    I want to turn off a virtual machine in the direct environment and then pull it out of the inventory.

    Then I want to go the VI4 Beta and browse the data store and add this virtual machine to inventory.

    These two environments may see the same LUNS / data warehouses.

    I did and it works however I want to make sure that it is an approved practice.

    You can do that normally without any problems. Even if the virtual machine is in a different datacenter inventory and there Powred-Off. You can map the logic unit number on the VI4 and add to the inventory of the VI4 another host.

    Recently, I did this practice to migrate from host with virtual machines in a different subnet to the host who knows the same setting SAN LUN in the other subnet.

    Best regards

    Hussain Al Sayed

Maybe you are looking for

  • How to remove lock to activate my iPhone?

    I'm lost password and account security question iCloud, but I have another apple id account connected to the iphone How to remove the lock of activation by another apple or connected accounts?

  • Should I buy the DVD with the new Satellite A300-16I of recovery?

    Hello Does anyone know if a windows Vista DVD should have been included in the box? If this is not the case, how can I receive a copy?Thanks for your help. Martijn

  • I can not syncronise with the apple tv and airplay utube

    I can synchronize with apple tv airplay, but if I want to see something on utube by airpllay itvdoes does not work, help

  • PCI device

    Hello Today I buy a "1000-1115TX NoteBook PC HP' and I download the chipset drivers and install them but there is a problem in the Device Manager: In the other devices category is a device that is not recognized... and this device name is "PCI Device

  • Need help to create and then using stored credentials

    I'm looking to automate several scripts to use thestorage of credentials for script of Alans vCheckThis post is exactly what I would do:# # Save the credentials of the Bank of VI credentials onceSe connect-VIServer -Server myVC0.domain.com -Credentia