VC of custom attributes in a report or dashboard

Hello
Is there a way to get a specific custom attribute in a report or dashboard?
I create a query but I do not see how to select a specific attributes of the VC
Kind regards
Ronald

Hello Ronald.
Are you collecting VC of custom attributes? What does the collector agent configuration file (foglightagent.winservice.exe.config) see flag below the?


Fake

If you collect those then below article should help:
vcommunity.Vizioncore.com/.../Easily-Create-vFoglight-services-based-on-vCenter-Custom-Attributes.aspx
Concerning

Tags: Dell Tech

Similar Questions

  • Reporting to include custom attributes of Vm and organized through multiple vcenters.

    Hello
    We are just moving our production test vfoglight solution & have you come across a bit of a weird one. We had a report / discovers that would list all virtual machines in our virtual Center and displays the custom attributes in a nice - good for the management report, form etc. However, we are moving to a new instance of virtual center & we have a test instance too - all are present in vfoglight, but our report draws only the custom of the original vcentre attributes. I'm not wcf script guru, but I gave it a good look & can't see a way forward - the hero of any script out there who could take a look and help out?
    Moreover, do you think I could put in a request for support for this one & get any joy?

    Hope someone can help - I'll post all the files needed etc.

    Kind regards

    Jonathan

    Thought of it at the end - on the second vcenter vmware foglight agent did not have the ability to collect custom attributes in the service.config file set to true. After true and restart the collector and the connector, everything was fine.

  • Get the custom attribute

    I am creating a report and I need to draw a custom attribute, user name and host name of vcenter.

    I use the following in Ecoshell

    Get - VM | Select name - ExpandProperty CustomFields | Where {$_.key - eq 'Client'}

    He gets me the name of the customer and the custom attribute 'Customer', but I don't know how to get the hostname of vcenter also in this same report. I have another command to extract the name of guets and vcenter name but I'm still learning and I'm not sure how to combine the two to get it as a report / outings, etc.

    See you soon,.

    Bradley sessions

    If you have found this or other useful information, please consider awarding points to 'Correct' or 'useful '.

    Must have misread, I'm sorry.

    Try this

    Get-VM -Server $defaultVIServers | Select Name, @{N="VCHost";E={($_ | Get-View).Client.ServiceUrl.Split("/")[2]}}, @{N="Attr";E={($_ | Get-Annotation | where {$_.Name -eq "Customer"}).Value}}
    

    Note that you first need to make a VIServer-connect to all your vCenters.

    All connected vCenters are in the $deaultVIServers variable.

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Update custom attributes - additional Note fields

    I tear my head off with getting a script works, maybe

    You can help

    I'm looking to see if a custom on all machines attribute is

    populated. If not then I would like to fill

    I can't seem to find the way out of the value of the

    attribute.

    The idea of the script would be to review all the VMS on a daily basis - see

    If they are populated with the field "date installation" – if not.

    means that they have been created in the past day. I would check if this field is

    filled, if not, get the date of creation of AD and fill and if the

    the machine is not windows, fill in the date of the day.

    This way I can also follow the old VM's to see if they are still

    necessary.

    Of course also allows to add to a report of all VM

    created by day and many other uses.

    I think it's in the note field

    Thanks a bunch

    Join the code here...

    ==============================================================================================

    This script will scan all the vm to check if the "Date installation" field has a value. Otherwise it will be the Active Directory query for the computer account creation date

    and fill in the field. If the information is not present in AD, then it will set the value for today's date

    ==============================================================================================

    $folder = Read-Host "Please enter the name of the folder:

    $tgtName = "date of installation.

    $today = Get-Date -uformat '% d/%m/%Y '.

    Get-file $folder | Get-VM | ForEach-Object {

    $cdate = Get-QADComputer -name $_. Name

    $vmid = (Get-view $_.ID)

    foreach ($fld in $vmid. Availablefield)

    {

    If ($fld. {Name - eq $tgtName)}

    $tgt = $fld. Key

    }

    foreach ($val in $vm. CustomValue) {}

    If ($val. Key - eq $tgt) {}

    If ($val. Value - eq "") {}

    If ($cdate - eq "") {}

    Get-vm $_. Name | Set-CustomField -name 'Date '.

    Installed" -value $today

    }

    Else {}

    $convertDate = $cdate.whencreated

    Get-vm $_. Name | Set-CustomField -name 'Date '.

    {Installed" -value $convertDate.ToShortDateString ()}

    }

    }

    }

    }

    }

    Thanks in advance...

    Maish

    Director systems & virtualization architect

    http://technodrone.blogspot.com

    The script below should do what you want.

    A few notes:

    • the logic to get the date of installation for Windows and Linux clients has been moved to a separate function

    • to cover all possibilities that I used 2 flags ($tgt and $found). According to these flags the custom attribute will be left alone, created or updated to date.

    • using the cmdlet Get-QADComputer requires the presence of the snap of the Quest.ActiveRoles.ADManagement.

    function Get-DateInstalled($VMname){
         $ADcomp = Get-QADComputer -Name $_.Name
         if($ADcomp -ne $null){
              $convertDate = $ADcomp.whencreated.ToShortDateString()
              return $convertDate
         }
         else{
              $today = Get-Date -uformat "%d/%m/%Y"
              return $today
         }
    }
    
    $folder = "POC"
    $tgtName = "Date Installed"
    $today = Get-Date -uformat "%d/%m/%Y"
    
    Get-Datacenter "ENG" | Get-Folder $folder | Get-VM | ForEach-Object {
         $vmid = (Get-View $_.ID)
         $tgt = (-1)
         foreach ($fld in $vmid.Availablefield) {
              if ($fld.Name -eq $tgtName) {
                   $tgt = $fld.Key
              }
         }
    
         $found = (-1)
         # "Date Installed" found
         if($tgt -ne (-1)){
              # Custom values present
              if($vmid.CustomValue -ne $null){
                   foreach($val in $vmid.CustomValue){
                        if($val.Key -eq $tgt){
                             $found = $val.Value
                        }
                   }
              }
         }
         if($found -eq (-1)){
              if($tgt -ne (-1)){
                   Get-VM $_.Name | Set-CustomField -name "Date Installed" -value (Get-DateInstalled $_.Name)
              }
              else{
                   Get-VM $_.Name | New-CustomField -name "Date Installed" -value (Get-DateInstalled $_.Name)
              }
         }
    }
    
  • Attribute of newspaper report

    Hello

    > I'm working with a test of "multiple numerical limit.

    > For each element of my painting 'measure', I created an attribute: a string whose name is "Channel".

    > Please see screenshot: you will see that while running, I change my attribute value: in the screenshot, for "the measure [2]" you can see that "Channel = ai30"it's exactly what I want! ".

    > But my problem is for the registration of my value of the attribute in the report... in the screenshot you can see the flag 'To include in the report' is set to true to my attribute of "Channel". In addition, the "Include in the report" report option parameter is also set to true. In my report, "Channel" attribute is included (as expected), BUT the value is not correct (it's the default: string a void :-().

    So my question is: why is my value of the attribute that is not reflected in the report?

    Thank you in advance for your help!

    J.

    I found the problem!

    When I tried to set the value of the attribute, I used an inappropriate object that was:

    RunState.Sequence.Main ["calculation of the values of the currents"]. Result.Measurement [RunState.LoopIndex]. Attributes.Channel = Locals.Channel_names [RunState.LoopIndex]

    It was stupid, because I put "a posteriori" of the value of an object that was not about to be used to generate reports.

    On the other hand, I should have used the next object to set the value in the local variable "list results" (which is used to generate the report):

    People of the country. ResultList [1]. Measurement [RunState.LoopIndex]. Attributes.Channel = Locals.Channel_names [RunState.LoopIndex]

    I am a beginner with TS, so please let me know if my explanation is not correct.

    J.

  • Custom attribute in the patch ACS4.2 17

    I have an optional custom attribute in my ACS group to pass on ACE config mode: shell: Admin * Admin by default-field

    Privilege level 15 is also part of the configuration of the exec.

    Recently I applied the patch 17 on ACS 4.2 (0) build 124. Since then I can not connect with the level of privilege 15 in IOS routers/switches.

    Looks like IOS box considers this attribute custom as a mandatory now.

    ---------------------------------------------------------------------------------------------------

    Debugging IOS (Cat6500, 12.2 (33) SXJ4):

    May 27, 13:23:56.819: MORE: application created for 61929 (pehruby)

    May 27, 13:23:56.819: MORE: previously set server group Ganymede 10.105.24.44 +.

    May 27, 13:23:56.819: HIGHER (0000F1E9) / 550052 A-4/NB_WAIT/0: started 5 sec timeout

    May 27, 13:23:56.819: HIGHER (0000F1E9) / 0/NB_WAIT: made event 2

    May 27, 13:23:56.819: HIGHER (0000F1E9) / 0/NB_WAIT: 62 bytes written requests

    May 27, 13:23:56.819: HIGHER (0000F1E9) / 0/READING: made event 1

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0/READING: would block during playback

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0/READING: made event 1

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0/READING: read all 12 byte header (wait for data 51 bytes)

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0/READING: made event 1

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0/READING: read all the answer 63 bytes

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0 / 550052 A 4: the package of treatment response

    May 27, 13:23:56.823: MORE: handled AV priv-lvl = 15

    May 27, 13:23:56.823: MORE: could not decode a unknown AV hull: FAIL

    May 27, 13:23:56.823: HIGHER (0000F1E9) / 0/REQ_WAIT / 550052 A 4: expired

    May 27, 13:23:56.823: MORE: Protocol is set to None. Jump

    May 27, 13:23:56.823: MORE: AV = shell shipping service

    May 27, 13:23:56.823: MORE: sending AV cmd *.

    ACS TCS.log (different time, same attempt):

    TC 27/05/2013 11:59:39 I 0043 5088 0 X 15< packet="" to="" client:10.106.11.114="" type:author/pass_add,="" seq="" 2,="" flags="">

    TC 27/05/2013 11:59:39 I 0043 5088 0 X 15 SESSIONID-998342923 (0XC47E7EF5), DATALEN 51 (0 X 33)

    TC 27/05/2013 11:59:39 type I 0043 5088 0 x 15 = AUTHOR/RESPONSE status = 1 (AUTHOR/PASS_ADD)

    TC 27/05/2013 11:59:39 I 0043 5088 0 x 15 msg_len = 0, data_len = 0 arg_cnt = 2

    TC 27/05/2013 11:59:39 I 0043 5088 0 x 15 size arg [0] = 11 = priv-lvl = 15

    TC 27/05/2013 11:59:39 I 0043 5088 0 x 15 size arg [1] = 32 = shell: Admin * Admin by default-field

    TC 27/05/2013 11:59:39 I 0043 5088 0 x 15 end >

    ------------------------------------------------------------------------------------------------------------------------

    Debugging IOS (C1841, 12.3 (14) T7):

    May 30, 12:21:58.248: AAA/BIND(00000A52): link i / f

    12:21:58.272 30 may: AAA/AUTHOR (0xA52): list of selection method "acs."

    12:21:58.272 30 may: MORE: AAA Queuing 2642 authorization for treatment

    12:21:58.272 30 may: HIGHER: processing of the application for authorization id 2642

    12:21:58.272 30 may: MORE: Protocol is set to None. Jump

    12:21:58.276 30 may: MORE: AV = shell shipping service

    12:21:58.276 30 may: MORE: sending AV cmd *.

    12:21:58.276 30 may: MORE: application created for 2642 (ph)

    12:21:58.276 30 may: MORE: previously set server group Ganymede 10.105.24.44 +.

    12:21:58.276 30 may: HIGHER (A 00000, 52) / 656FB000/NB_WAIT/0: started 5 sec timeout

    12:21:58.276 30 may: HIGHER (A 00000, 52) / 0/NB_WAIT: made event 2

    12:21:58.276 30 may: HIGHER (A 00000, 52) / 0/NB_WAIT: 59 bytes written requests

    12:21:58.276 30 may: HIGHER (A 00000, 52) / 0/READING: made event 1

    12:21:58.276 30 may: HIGHER (A 00000, 52) / 0/READING: would block during playback

    12:21:58.280 30 may: HIGHER (A 00000, 52) / 0/READING: made event 1

    12:21:58.280 30 may: HIGHER (A 00000, 52) / 0/READING: read all 12 byte header (wait for data 51 bytes)

    12:21:58.280 30 may: HIGHER (A 00000, 52) / 0/READING: made event 1

    12:21:58.280 30 may: HIGHER (A 00000, 52) / 0/READING: read all the answer 63 bytes

    12:21:58.280 30 may: HIGHER (A 00000, 52) / 0/656FB000: the package of treatment response

    12:21:58.280 30 may: MORE: handled AV priv-lvl = 15

    12:21:58.280 30 may: MORE: could not decode AV shell: Admin * Admin by default-field - PASS - PASS

    May 30, 12:21:58.284: AAA/AUTHOR/EXEC(00000A52): AV cmd = treatment

    May 30, 12:21:58.284: AAA/AUTHOR/EXEC(00000A52): successful authorization

    ACS.log:

    TC 30/05/2013 12:21:58 I 0043 1280 0 X 0< received="" from="" client:10.106.0.50="" type="AUTHOR," seq="1," flags="">

    TC 30/05/2013 12:21:58 I 0043 1280 SESSIONID 0 X 0 1990425999 (0X76A37D8F), DATALEN 47 (0X2F)

    TC 30/05/2013 12:21:58 I 0043 1280 type 0 x 0 = AUTHOR, priv_lvl = 1, authentic = 1

    TC 30/05/2013 12:21:58 I 0043 1280 0 x 0 METHOD = Ganymede +.

    TC 30/05/2013 12:21:58 I 0043 1280 SVC 0 X 0 = 1 USER_LEN = 2 PORT_LEN = 6 REM_ADDR_LEN = 12 ARG_CNT = 2

    TC 30/05/2013 12:21:58 I 0043 1280 0 x 0 USER = ph

    TC 30/05/2013 12:21:58 I 0043 1280 PORT 0 x 0 = tty195

    TC 30/05/2013 12:21:58 I 0043 1280 0 X 0 = 10.106.33.22 REM_ADDR

    TC 30/05/2013 12:21:58 I 0043 1280 0 x 0 arg [0](size=13) = service = shell

    TC 30/05/2013 12:21:58 I 0043 1280 0 x 0 arg [1](size=4) = cmd *.

    TC 30/05/2013 12:21:58 I 0043 1280 0 X 0 END >

    TC 30/05/2013 12:21:58 I 0850 3244 1 allocated connection wire work unique 0xf

    TC 30/05/2013 12:21:58 I 0143 3244 0xf author data: phtty19510.106.33.22service = shellcmd. = 13362timezone = MEZservi

    TC 30/05/2013 12:21:58 I 0163 3244 0xf - excerpts from the info service

    TC 30/05/2013 12:21:58 I have 0189 3244 0xf - Checked NARs

    TC 30/05/2013 12:21:58 I 0199 3244 0xf - implemented Reqs:

    TC 30/05/2013 12:21:58 I 0209 3244 0xf - a profile

    TC 30/05/2013 12:21:58 I 0261 3244 0xf - executed

    TC 30/05/2013 12:21:58 I 0263 3244 0xf - set of controls done clean

    TC 30/05/2013 12:21:58 I 0265 3244 0xf - version NDG provided

    TC 30/05/2013 12:21:58 I 0043 3244 0XF< packet="" to="" client:10.106.0.50="" type:author/pass_add,="" seq="" 2,="" flags="">

    TC 30/05/2013 12:21:58 I 0043 3244 SESSIONID 0XF 1990425999 (0X76A37D8F), DATALEN 51 (0 X 33)

    TC 30/05/2013 12:21:58 I 0043 3244 0xf type = AUTHOR/RESPONSE status = 1 (AUTHOR/PASS_ADD)

    TC 30/05/2013 12:21:58 I 0043 3244 0xf msg_len = 0, data_len = 0 arg_cnt = 2

    TC 30/05/2013 12:21:58 I 0043 3244 0xf arg [0] size = 11 = priv-lvl = 15

    TC 30/05/2013 12:21:58 I 0043 3244 0xf arg [1] = 32 = shell size: Admin * Admin by default-field

    TC 30/05/2013 12:21:58 I 0043 3244 0xf end >

    PuTTY session:

    Connect as: ph

    [email protected]/ * / password:<------ (10.106.0.16="" and="" 10.106.0.50="" are="" ip="" addresses="" of="" the="" same="">

    1841_hra_lab >

    1841_hra_lab ><------ i'm="" not="" in="" enable="" mode="" (priv.level="">

    --------------------------------------------------------------------------------------------------------------------

    Unfortunalety I don't have newspapers/debug of the period before the update, when everything was ok.

    I guess that the problem is somewhere in this argument that goes from the ACS to the customer:

    TC 30/05/2013 12:21:58 I 0043 3244 0xf arg [1] = 32 = shell size: Admin * Admin by default-field

    Can someone tell me how this argument with the option setting should look like?

    Maybe * shell: Admin * Admin by default-field?

    Petr

    Hi Peter,

    You are using in a default.

    CSCth75577    ACS incorrectly sends optional custom attributes GANYMEDE +.

    Symptom:

    Authorization GANYMEDE + IOS fails if client attributes (even as an option) are configured on the ACS user group.  The connection will work, but the attributes passed will be not honored.

    Conditions:

    ACS 4.2.0.124 patch 16

    ACS 4.2.1.15 patch 2

    Workaround solution:

    Return to a previous fix ACS.

    This problem has been fixed in

    ACS 4.2.1.15 patch 3 or later.

    Upgrade of the ACS to 4.2.1.15 and apply the latest patch 10.

    Jatin kone
    -Does the rate of useful messages-

  • Custom attributes of access in a bean managed to webcenter 12 c

    WebCenter Portal: Webcenter 12 c

    How can I access custom attributes in a bean managed to webcenter 12 c.. ?

    I found the following blogpost to 11.1.1.8: http://blog.vassit.co.uk/knowledge/access-global-custom-attributes

    It is said to add libraries:

    • Model of WebCenter spaces
    • WebCenter spaces customer

    Cannot find these libraries in snapshot .ee 12 c.

    Update:

    The class I used in this blog post only works in 11g and it is an internal class that should be avoided to use as it may change in future versions.

    It is an example of change.

    It is offered in the Public Oracle Fusion Middleware Java QAnywhere for Oracle WebCenter Portal class WCApplicationContext that will allow you to access using Java through many steps.

    WCApplicationContext wcAppCtx = WCApplicationContext.getCurrentInstance();
    WCApplication wcApp = wcAppCtx.getApplication();
    WebCenterType wcMeta = wcApp.getApplicationConfig();
    CustomAttributes customAttr = wcMeta.getCustomAttributes();
    ...
    

    This course may not be available in the libraries provided by JDeveloper 12.2.1 and you include library webcenter-core - api .jar manually.

    I don't know why these classes are in the library and not offered public API catalog of libraries of the ADF in the JDeveloper 12.2.1

    Anyway, as suggested by the use of Vinay and his colleagues the EL Expression as he goes to work.

    Note: I'll blog in my personal blog

    Hope this information helps everybody.

    Kind regards.

  • Custom attribute in the model layer properties

    Hey all,.

    Can someone explain the flow of the program "ADF practice: using custom attribute in the model layer properties of". "" Basically, how change custom properties like "customLabel" changed the label attribute. Is there properties specific adf we can refer to properties for the attribute?

    Reference will also be useful.

    Thank you!!

    What exactly you want to know?

    It's pretty clear from what I've read:

    You can set properties that are customized for each attribute in a vo. This is done in the vo attributes dialog box where the default value.

    You can override the default values that is done in the setCustomHints() method. This method is called by the button in the user interface (actionListener = "#{bindings.setCustomHints.execute}" ")

    The inputtext is set to display the properties for the label (label = "#{bindings.") DepartmentName.hints.customLabel}') and uses the custom readOnly property (readonly = "#{bindings.") DepartmentName.hints.readonly}')

    As the inputText component is updated after the button clicked on (via a pertial in the inputText trigger), it shows the a values.

    Timo

  • Change after the addition of custom attribute

    Hello

    I use OIM R2 PS1 and the commissioning of OUD user via the connector.

    Depending on the condition, I added a new custom attribute "HomePhone". However, the value of attribute for this attribute is only pushed for the newly created user. For a user (prior to adding the custom attribute), the attribute values runs not more than on the side of the OUD.

    Is there a planner that I need to run?

    Thank you, John

    Hello

    I'm sure that you have not finished the second part of the extension of connector - "Configurations to achieve synchronization app downstream." However, you mentioned that you don't see a problem with the new user, however if you update the value of the attribute, it does not flow down to OUD, as older users.

    Please go through the link: extend the functionality of the connector

    The steps would be - creating new tasks within the definition of processes, mapping, etc..

    Thank you.

  • custom attributes for a virtual machine or more

    is it possible to create a custom attribute for VMA, lets say "data center region", then look for this attribute later.

    You can use the cmdlet New-CustomAttribute to create custom attributes (you can also do this through the client, but this is the forum PowerCLI!).

    You can then use the cmdlet Get-CustomAttribute to query what attributes to define in your vCenter.

    And to get the value of the attribute of an object, the CustomFields property contains an array of all the custom attributes.

    for example ((get-vm vm).) CustomFields | Where {$_.} The key - eq 'attributeName' value})

  • Retrieves a custom attribute and store it in a workflow attribute?

    Hello.

    Maybe I'm confused on this subject, but from the looks of it, I can't take the custom attribute that is retrieved using

    com.vmware.library.vc.customattribute.getCustomField)

    and assign it to an attribute of workflow for use later, or even check the value.

    From the looks of the workflow, it records only the value.

    Is it possible to natively in vRO?

    Thank you!

    Anoop

    Are you trying to retrieve the custom attribute using the workflow "toget the attribute custom" (in the folder library/vCenter/Custom attributes )?

    If so, then Yes, this workflow only saves the retrieved attribute and does not return as an output parameter. You have the following options:

    • Write your own workflow to help "get the attribute custom" as a starting point. You can duplicate, then add a new parameter of type string and set it to the value of customAttributeValue.
    • Directly call the com.vmware.library.vc.customattribute.getCustomField () action in your script code and use its return value of string.
  • Create a custom attribute to model the growth rate of the data store used space

    I would like to see data warehouses are growing fastest of the environment in terms of GB per day or something similar.  Is it possible to use a custom attribute to apply a formula that measures the rate of growth of a store of data over time, which allows me to see what data stores fastest?

    You would look for an average simple mobile for a SM you describe. vC Ops does not simple moving average formulas for SMs at this time.

    Looks like you are looking for a "growth rate", but you really won't get it with the built-in attributes. You might look differently and look at the remaining capacity and the remaining time metric. Also, you could create additional widgets to view graphs of util % over the last 30-90 days to give a better picture of usage in GB, #VMs, etc.

    I also suggest to make a Top - N showing use the lowest of the remaining time metric and the remaining ability... This will give you your data warehouses that are more at risk.

  • Someone removed the custom attributes field

    Is it possible that PowerCLI can fire an event if someone removed the field of the custom in vCenter attributes?  I take more precisely on the class in Administration > custom attributes in vSphere client 5.x.  For some reason a field that he had to show VM assignments is missing, and I'll try to find what happened to her.

    Course, use the CustomFieldRemovedEvent.

    You can use the Get-VIEvent or my Get-VIEventPlus cmdlet to retrieve the events.

    BTW use my Event-O-Matic to easily find event names.

    Special Edition, it will still generate code to extract the events

  • Add current VM to custom attribute datastore

    I am trying to find a way to fill the custom attribute "Data store" with the name of the data store of the data store that the virtual machine is running. I want to achieve this by using the PowerCLI. We use vSphere 5.0. I tried to google for it, but I couldn't find a solution. Since I'm not very good in the script I could find a solution for me. Thanks for any help.

    CustomField cmdlets are obsolete (they disappear on the next versions ethe).

    Try it like this

    $ca = Get-CustomAttribute -Name Datastore -ErrorAction SilentlyContinue if(!$ca){
      $ca = New-CustomAttribute -Name Datastore -TargetType VirtualMachine}
    
    foreach($vm in Get-VM){
      Set-Annotation -Entity $vm -CustomAttribute $ca -Value (Get-Datastore -RelatedObject $vm | select -ExpandProperty Name)
    }
    
  • Change the VM with custom attributes defined in a CSV file

    Hi all

    I'm doing something that I think should be simple (but this is the first time I used powercli and am not a good code writer), but I find it hard to tell.

    I created 2 custom attributes (owner and owner of the SSG system) in vCenter for my virtual machines.  I have a list of vm names csv and their associates "owners".  I would use powercli to read the csv file and connect to the VC server and the 'owners' of entry in the appropriate field.

    I borrowed com code from various places on the internet and these forums but I can't seem to make it all work.  I managed at least to read the information in the csv file and is displayed on the screen of my laptop.  What I can't do is get 3 columns in the csv file to be recognized as variables (unless there is some default variables I don't know) I can put in the game-Annotation lines.

    The code I have is:

    # Input range, includes all IBD VM names that are registered.
    $data = import-Csv "C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\vmowners1.csv"-Header ('Hostname', 'Owner', 'SSG owner')
    # $data | Get-Member
    Write-Output $data
    # Loop over all the VMS in vCenter
    ForEach ($row in $data)
    {
    # Create variables for the current virtual and its 'Contact' and 'Description' computer that are custom attribute fields.  Also create a $note string to use Set-VM-Description
    $hostname = get-VM-name $vmname;
    # $contact = $vm | Get-Annotation CustomAttribute - user;
    # $description = $vm | Get-Annotation - CustomAttribute Description;
    # $note = $contact.name + ":'t" + $contact.value + "' not n" + $description.name + ":'t" + $description.value;
    Set Annotation - entity $hostname - CustomAttribute "Business system owner" - value $SSG_owner
    Set Annotation - entity $hostname - CustomAttribute "SSG system owner" - value $system_owner
    # Set - VM - VM $vm - $note Description - confirm: $false;
    }

    The result, I get on my screen is:

    PowerCLI C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts >.\setvmownership.ps1

    Owner of the company that owns SSG host name

    --------                                              --------------                                       ---------

    ABPPROXY-00-AH

    ACE-01-AH hung Laallmmi hung Laallmmi

    Get - VM: could not validate the argument on the parameter 'name '. The argument is null or empty. Provide an argument that is not null or empty, and then try the AGM of the order

    in.

    To C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\setvmownership.ps1:13 char: 29

    + $hostname = get-VM-name < < < < $vmname;

    + CategoryInfo: InvalidData: (:)) [Get - VM], ParameterBindingValidationException)

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

    Set Annotation: Impossible to validate the argument on the parameter "entity". The argument is null. Supply a non-null argument, and try the command again.

    C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\setvmownership.ps1:17 char: 23

    + Set-Annotation - entity < < < < $hostname - CustomAttribute "Business system owner" - value $SSG_owner

    + CategoryInfo: InvalidData: (:)) [game-Annotation], ParameterBindingValidationException)

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.SetAnnotation

    Set Annotation: Impossible to validate the argument on the parameter "entity". The argument is null. Supply a non-null argument, and try the command again.

    C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\setvmownership.ps1:18 char: 23

    + Set-Annotation - entity < < < < $hostname - CustomAttribute "SSG system owner" - value $system_owner

    + CategoryInfo: InvalidData: (:)) [game-Annotation], ParameterBindingValidationException)

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.SetAnnotation

    Get - VM: could not validate the argument on the parameter 'name '. The argument is null or empty. Provide an argument that is not null or empty, and then try the AGM of the order

    in.

    To C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\setvmownership.ps1:13 char: 29

    + $hostname = get-VM-name < < < < $vmname;

    + CategoryInfo: InvalidData: (:)) [Get - VM], ParameterBindingValidationException)

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVM

    Set Annotation: Impossible to validate the argument on the parameter "entity". The argument is null. Supply a non-null argument, and try the command again.

    C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\setvmownership.ps1:17 char: 23

    + Set-Annotation - entity < < < < $hostname - CustomAttribute "Business system owner" - value $SSG_owner

    + CategoryInfo: InvalidData: (:)) [game-Annotation], ParameterBindingValidationException)

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.SetAnnotation

    Set Annotation: Impossible to validate the argument on the parameter "entity". The argument is null. Supply a non-null argument, and try the command again.

    C:\Program Files (x 86) \VMware\Infrastructure\vSphere PowerCLI\scripts\setvmownership.ps1:18 char: 23

    + Set-Annotation - entity < < < < $hostname - CustomAttribute "SSG system owner" - value $system_owner

    + CategoryInfo: InvalidData: (:)) [game-Annotation], ParameterBindingValidationException)

    + FullyQualifiedErrorId: ParameterArgumentValidationError, VMware.VimAutomation.ViCore.Cmdlets.Commands.SetAnnotation

    The CSV file looks like this (but continues for about 500 VMS):

    I go with the option import-csv because that said something that I read in my troubleshooting efforts would empty columns and error I received and that import-csv correctly would intrepret in empty columns.

    hostname, business_owner, system_owner,

    ABPPROXY-00-AH,

    ACE-01-AH, James Laallmmi, James Laallmmi,

    acrodev-00-ah, tflessa, Bruce Hastings,.

    ACT1DDB00AH, Bill Mancini, Mike Bruni,

    ACT1TDB00AH, Bill Mancini, Mike Bruni,

    What should I do to be able to get this script to work? I don't know that it is related to messages "argument is null." that we see in the output.

    Thank you

    Dan

    Hello, dscottimw-

    You were on the right track.  There were a couple of things to change to make it work as you want:

    1. either remove the "-header" part of the Import-Csv line or delete the actual header of the CSV itself - these are elements in conflict (the "-Header" param names of the columns in the CSV and assumes that the CSV file has already no header row)
    2. you need to access the properties of the $row variable in the ForEach loop - not only call the names of the CSV column headers (this is why you may receive errors on things 'null' - whether you use variables that have no value)

    Try this:

    # Input array, includes all VM names from DCI that are registered.$arrVMsInfo = Import-Csv "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\scripts\vmowners1.csv"#Write-Output $data
    
    ## loop through all VMs listed in the CSV, setting custom attrib values for eachForEach ($row in $arrVMsInfo) {    ## get the VM for this row    $vmThisOne = Get-VM -Name $row.hostname    Set-Annotation -Entity $vmThisOne -CustomAttribute "Business System Owner" -Value $row.business_owner    Set-Annotation -Entity $vmThisOne -CustomAttribute "SSG System Owner" -Value $row.system_owner} ## end foreach
    

    And, to give it a shot without actually play the game on annotations, to make sure things go as you like, you could add a - WhatIf to each line in Set-Annotation in the ForEach loop.

    Which works better for you?

Maybe you are looking for