help reqd with the cmdlet "get-customattribute.

Hey all

Can someone help me with the cmdlet above pls?

What I'm trying to do, it is all simply do a search in our VC against some "custom attributes" and confirm the virtual machines associated with them.

(i.e. custom attribute 'RED' has a servers VM called "SERVER1, SERVER2, etc.")

I tried to find objects associated with this and all I get is the following objects:

ServerId
Server
That is to say;
Name
TargetType
UID
Customer

So, how can I use these to get something that again relates a servernames VM?

As usual - thank you very much in advance for your help

Munster99

Of course, try it like that

Get - VM | Get-Annotation - CustomAttribute "red" | Where {$_.} Value}

Tags: VMware

Similar Questions

  • Help with the cmdlet "get-floppydrive.

    Hey all

    Need help please? I'm trying to create a little script to check if a virtual machine has a floppy drive. I had a quick glance at the cmdlet GET-floppydrive and pretty much know how to check the configuration to a floppy disk "connected" (i.e. of connection state to connect to poweron e.t.c). I want to know is how an abouts to go check if a floppy drive is period

    I thought it might be something like that, but I think that its probably wrong.

    $vm = get - vm server1

    If ($vm.floppydrives - eq $True) {}

    Write to $vm.name

    }

    Any ideas?

    Munster

    You were near.

    $vm = get-vm server1
    
    if ($vm.floppydrives){
    Write $vm.name
    }
    

    You actually test it this way, what if $vm.floppydrivers is equal to $null or not.

    If there is no floppy drives that the property will be $null and the test will evaluate to $false.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Using the cmdlet Get-stats for the problems of performance of ESXi

    I need to detect the bottlenecks (if any) causing poor performance with a (free) 5.5 ESXi host.

    I see that if I use the cmdlet Get - stat PowerCLI I get dozens of meters, such as "mem.usage.average" or "'rescpu.maxlimited1.latest ', just to give two samples. "

    Can I identify a subset of the counters I should follow to identify possible bottlenecks in the fastest way possible?

    Concerning

    Marius

    Everything depends of course.

    There are several positions which list a number of key counters to watch.

    The Hosts of ESXi monitoring - a deeper on the what and the why look , you will find a good starting set.

  • Question about the cmdlet Get-VIProperty (ideally oriented @ LucD)

    Hello everyone

    Sorry for the title of discussion, but once you read on you will understand where I come from.

    I am reorganizing ALL my scripts powercli, functions, advanced et al. to TRY to become more 'effective' (dare I say) in my script. So to start I thought useful the cmdlet "Get-VIProperty" has been and I wanted to use much more. Did some autour research and found a great download LucD had prepared on his blog of a variety of different VIProperties. Directed practice how they were immediately started to use what he blogged about his position.

    My question is this (and its powershell probably more than PowerCLI "maybe"): when I am trying to add in the VIProperties in my "profile (so they load into a starting window of console PS) I go in the following example:

    New-VIProperty - ObjectType Cluster - name _NumberOfVmotions-value {param ($cluster) $cluster. ExtensionData.Summary.NumVmotions} - Force

    It works when entered in a session of PS, however, when I load the following:

    New-VIProperty-name _NumCPU - ObjectType Cluster - value {$TotalPCPU = 0 $Args [0] |} Get-VMHost | foreach {$TotalPCPU += $_.} {NumCPU} $TotalPCPU}-Force

    However, when I load it as follows:

    New-VIProperty-name _NumCPU - ObjectType Cluster

    -Value {}

    $TotalPCPU = 0

    $Args [0] | Get-VMHost | {foreach}

    $TotalPCPU += $_. NumCPU

    }

    $TotalPCPU

    } - Force

    THIS WORKS.

    I know this may sound pedantic, but I would like to organize my viproperties like below, so they are a little more clear on the page. That is why the requirment to see if the above commands could be executed as 'one-liners ':

    # NumberOfHosts

    New-VIProperty - ObjectType Cluster - name ' _NumberOfHosts

    -The value {param ($cluster) @($cluster.) {Extensiondata.Host). County} - BasedOnExtensionProperty 'To host' - Force

    # NumberOfVMs

    New-VIProperty - ObjectType Cluster - name ' _NumberOfVMs

    -The value {param ($cluster)($cluster.)} Extensiondata.Host | % {Get-view $_} | Measure-object - InputObject {$_.} Vm.Count} - sum). Sum} '

    -BasedONextensionProperty 'host' - Force

    So if it's not possible it's fine - I just wanted to be able to confirm, it's all.

    As usual, thank you very much in advance for help

    Concerning

    Munster99

    If you want to add two other PowerShell/PowerCLI commands on a single line, you must use the semicolon to separate them:

    New-VIProperty-name _NumCPU - ObjectType Cluster - value {$TotalPCPU = 0; $Args [0] |} Get-VMHost | foreach {$TotalPCPU += $_.} NumCPU}; $TotalPCPU} - force

  • script need help to change the VMinfo Get to include no RDM

    Hello world

    Could someone help me with the script which retrieves information for VMGuests. I would like to modify this script to include NO RDM, if possible.

    Thanks for your help

    # The Get-VMInformation function gets information of VM
    Function Get-VMInformation {}
    {in process
    Get - VM | Sort-Object-property name. `
    Select-Object Name,@{N="UsedSpaceMB; E = {[math]: tour ($_.)} (UsedSpaceGB * 1 Ko, 0)}}, NumCpu, MemoryMB,.
    @{N = "SnapshotSizeMB"; E = {[math]: round (($_ |))} Get-Snapshot | Measure-Object-SizeMB property-sum). Sum, 0)}}
    }
    {end}
    "" | Select-Object @{N = "Name"; {E = {"{0:yyyy - MM - DD} ' f (Get-Date)"}}, UsedSpaceMB, NumCpu, MemoryMB, SnapshotSizeMB
    }
    }

    # Get all information from the virtual machine and export it to the output file
    Get-VMInformation |
    Export-Csv-path $OutPutFile - NoTypeInformation - UseCulture

    Try this

    # The Get-VMInformation function gets all the VM information function Get-VMInformation {
        process {
            Get-VM | Sort-Object -Property Name | `        Select-Object Name,
            @{N="UsedSpaceMB";E={[math]::Round((Get-HardDisk -VM $_ | where {"RawPhysical","RawVirtual" -notcontains $_.Disktype} | Measure-Object -Sum -Property CapacityKB).Sum/1KB)}},
            NumCpu,MemoryMB,
            @{N="SnapshotSizeMB";E={[math]::Round(($_ | Get-Snapshot | Measure-Object -Property SizeMB -Sum).Sum,0)}}
        }
        end {
            "" | Select-Object @{N="Name";E={"{0:yyyy-MM-dd}" -f (Get-Date)}},UsedSpaceMB,NumCpu,MemoryMB,SnapshotSizeMB
        }
    }
    
    # Get all the VM information and export it to the output file Get-VMInformation | Export-Csv -Path $OutPutFile -NoTypeInformation -UseCulture
    
  • How do I see the full message with the command Get-VIEvent

    Hello list,

    I was trying to see the VIevents with the command get-vievent as below

    Get-VIEvent-type error - MaxSamples 20 | Format-Table Createduserid, FullFormattedMessage - autosize

    In this case, if it's a great message, the fullFormattedMessage displays incomplete messages (for example/error found on & lt;) ESX IP & gt; in & lt; Centre for data & gt ;...) ... what should I wear to display the full message with the command Get-VIevent?

    Thank you

    Krishnaprsad

    This is the Format-Table cmdlet, which shows only a part of the message.

    If you want to see the full message, you could do

    Get-VIEvent -Type Error -MaxSamples 20 | %{Write-Host $_.CreatedTime $_.FullFormattedMessage}
    

    The alternative is to adapt the formatting instructions in the VMware.VimAutomation.Format.ps1xml file.

    But that could impact other cmdlets and is a bit more complicated.

  • Hello! Can someone help me with the address of repair service for Palm TX?

    Hello! Can someone help me with the address of repair service for Palm TX?

    Good luck and please, let us know here how it works for you.  We like to know current resources, which can help to solve the problems of people with these older devices.

  • I can't make a connection wifi with my Nook Color camera using a Microsoft MN - 700 wireless router. Can someone help me with the settings that could take care of this problem?

    I can't make a connection wifi with my Nook Color camera using a Microsoft MN - 700 wireless router.  Can someone help me with the settings that could take care of this problem? I have a Dell netbook and a laptop HP working with the router so I know it works.  The Nook also works in a Barnes & Noble store it seems so that the works of Nook.  I have a similar problem with a LG Vortex phone where I can't do the wi - fi connection.

    Please post on the Support forums technical Nook for help because it is not a Windows 7 problem...

    http://bookclubs.barnesandnoble.com/T5/nook-technical-support/BD-p/nooksupport

    .. .also than that...

    http://www.barnesandnoble.com/u/nook-support-connectivity/379002491/

    Don't forget the network encryption type, IE. WPA2/WPA and key/password / password must match the wireless router/access point.

    See also this about WPA2 on the MN-700...

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-networking/cant-connect-to-MN-700-wireless-router/1789978f-7C90-4686-A956-2d17eb79960d

  • can someone help me with the link to download hp2050 print drivers that are compatible with windows 8.

    can someone help me with the link to download hp2050 print drivers that are compatible with windows 8, my software CD is not compatible with windows 8, and I can't use the printer now.

    Hello

    The installation program "Full Feature" can be found on the following link.

    http://h10025.www1.HP.com/ewfrf/wc/softwareDownloadIndex?softwareitem=Al-109407-2&cc=us&DLC=en&LC=en&OS=4132&product=4027469&sw_lang=

    Kind regards

    DP - K

  • Clouds (can someone help me with the error code 214?)

    can someone help me with the error code 214?

    Hello

    Reference:--

    Error code 214

    Error in downloading, installing or updating Adobe Creative Cloud applications

  • HI all I would like to ask if you help me, I want to draw paths, but when I use options to mark with a pen or brush settings I lose quality when I Zoom, can someone help me with the settings for the pen?

    HI all I would like to ask if you help me, I want to draw paths, but when I use options to mark with a pen or brush settings I lose quality when I Zoom, can someone help me with the settings for the pen?

    The work path is a vector and infinitely scalable, but when caress you, Photoshop sets the pixels on a layer following the path.  These pixels are rasterized and based and cannot be resized without loss of quality.  You have options.  If you want to enlarge the raster layer, transform the work path and stroking again.  Or work at a resolution higher, in the first place.

    Either incidentally, you can't trace a path with the pen, because it's a vector tool, and caressing is a matrix function based.

  • As a gesture of goodwill, we can help you with the upgrade for PSE 13. We ask you to place the order for Adobe Photoshop elements 13 upgrade and then provide you with the serial number of the full version for the same product against the new upgra

    I have RECIVED YEAR EMAIL FROM ADOBE AS: as gesture of goodwill, we can help you with the upgrade for PSE 13. We ask you to place the order for Adobe Photoshop elements 13 upgrade and then provide you with the serial number of the full version of the product, even against the new order of upgrade"IS this UPGRADE FREE AND CE WHO SHOULD DO, HOW can I HAVE THIS UPGRADE?

    HOW I CAN PLACE THE ORDER AND IS IT FREE?

  • Problem with the cmdlet Remove-Snapshot

    Hello everyone,

    I have a problem with the cmdlet Remove-Snapshot: it fails to remove the snapshot when I made a copy of file (Copy-Item) between calls to New-Snapshot and Remove-Snapshot if (and only if) I put - confirm option to $false. If - confirm is $true everything works, but it does not allow me to run the non-interactive script. The error that is returned is "vim.fault.InvalidVmConfig".

    Anyone know if there is a problem on my side, on the side of ESX Server or a bug in the VI Toolkit? Any possible workaround?

    I have attached the PowerShell script, I used to reproduce the error and the script log file that contains the error message.

    The versions I used are:

    VMware.Vim.dll (1.5.0.1299, "VI API 1.5.0 build.Net 142961")

    VMware ESX Server 3i, 3.5.0 110271

    I'm not able to reproduce this on my environment but I am sure that the issue is not with the - confirm: $false parameter. After you copy the file there is a timeout that is set to 10 seconds. Can you increase it (even if I do not at all see a reason of this time-out) and see what happens?

    \Yavor

  • Help required with the viproperty cmdlet

    Hi all

    I have a question where I am trying to establish the disknames associated with a particular data store. I created a new viproperty and I found where the "diskname" object - that is, "extentiondata.info.vmfs.extent.diskname" is located.

    The problem is, where we have warehouses of data with more of a measure, it will not display anything. Therefore, I am trying to create a value of 'viproperty' which combines the disknames with the data store measure. I think it's just a matter of finding ways in addition to a value in the output console.

    Could someone please?

    Thanks in advance

    Munster

    The parameter Value can be a block of code.

    Something like that

    New-VIProperty -ObjectType Datastore -Name _DSDiskNames_ -Value {
      param($ds)
    
      $disknames = $ds.ExtensionData.info.vmfs.extent | %{
        $_.DiskName  }
      [string]::Join(',',$disknames)
    } -Force | Out-Null
    Get-Datastore MyDS | Select Name,_DSDiskNames_
    

    There are some examples in VIProperties.

  • Where the cmdlet "Get-USBController? (Even with Remove - and new-)

    The command ' get-usbdevice "(also" Remove-UsbDevice ") should recover USB devices that may be located on a virtual machine." " The problem is that cmdlt shows only USB devices, if a USB device is connected. It will not report anything if the virtual machine has added a USB device, but it is not currently connected to anything (IE just a USB controller).

    Now there are other ways that I can get if the VM has the unwanted material:

    $unwantedhw = “floppy|serial|usb”
    (Get-VM $VMname | Get-View).Config.Hardware.Device | Select -Expand DeviceInfo | Select Label, Summary | where {$_.Label –match $unwantedhw}
    

    I just thought that instead of having to go back to the shenanigans of get - view, I could do it directly with 1 command as the command "Get-UsbDevice" should do in my opinion. I was able to try to write my own function (IE Get USBController) for it and store it in my profile, but I don't have time on the atmosphere of the hand.

    Someone at - it else created this function or get updates for the PowerCLI to include in a newer version of the feature?

    Versions of PowerCLI:

    VMware vSphere PowerCLI 5.0.1 build 581491

    VMware AutoDeploy PowerCLI component 5.0 build 544967

    VMware ImageBuilder PowerCLI component 5.0 build 544967

    VMware vCloud Director PowerCLI component 1.5 build 581492

    License of VMware PowerCLI component 5.0 build 544881

    VMware vSphere PowerCLI component 5.0 build 581435

    VSphere VMware Update Manager PowerCLI 5.0 build 432001

    Try this.

    This is my seminal function of Get-UsbController.

    function Get-UsbController{
      param(
      [CmdletBinding()]
      [parameter(Mandatory = $true, ValueFromPipeline = $true)]
      [PSObject[]]${VM}
      )
    
      process{
        foreach($vmObj in $vm){
          if($vmObj -is [System.String]){
            $vmObj = Get-VM -Name $vmObj      }
          $vmObj.ExtensionData.COnfig.Hardware.Device |      where {$_ -is [VMware.Vim.VirtualUSBController]} | %{
            New-Object PSOBject -Property @{
              Name = $_.DeviceInfo.Label          Summary = $_.DeviceInfo.Summary          AutoConnectDevices = $_.AutoCOnnectDevices          EhciEnabled = $_.EhciENabled          BusNumber = $_.BusNumber          UnitNumber = $_.UnitNumber        }
          }
        }
      }
    }
    
    Get-VM MyVM | Get-UsbController
    

Maybe you are looking for

  • Firefox won't download PDF files with javascript:doDownload();

    I just installed Firefox version 9.0.1, hoping that it would solve this problem, but no luck. My bank allows me to download and print my credit in the form of PDF files on their site. I checked the code and the button that I click implements a javasc

  • G505 BIOS/UEFI unlock?

    Hi guys. Newbie to the forum here. I was wondering if there is a way to install another operating systemin Mode UEFI on InsydeH20 BIOS? (IE Arch Linux, etc...) So far, I'm stuck to boot from USB or CD as they -for some reason-redirect to normal victo

  • I would like to know if I can upgrade the graphics card in my laptop.

    I'm looking to upgrade my laptop into a portable game. I can take it if I want to. I have a laptop of HP 15. I know that I can increase the ram. I checked on the essential. If I can't update the graphics card, a laptop that should get. If I can upgra

  • Replace table 1 d at a specific point in the 2D array

    Hello I have a chart 2D with a lot of information and the only want to replace data at a specific point, see image: When I use the subassembly to replace I can replace only a specific line and column item... Best regards Thijs Boeree

  • SharePoint [IM002] connect to the navision database error

    original title: sharepoint error When I tried to connect the navision database. I get an error message ' ERROR [IM002] [Microsoft] [ODBC Driver Manager] Data source name not found and no default driver specified ". My connection string is:DSN = Micro