Size RDM adding custom fields

I tried out these scripts and found the size of the useful snapshot we have a bit of a crisis of storage, trying to retrieve everything we can until we can buy more:

http://www.peetersonline.nl/index.php/VMware/add-custom-fields-to-VI-client-with-PowerShell-samples/

My goal is to add an another custom field for ROW size, keeping in mind it must be a sum of all RDM on the virtual machine as some virtual machines have 2 or 3 RDM.

The code I use to get the ROW size is:

$capacity = 0
Get-datacenter "systems data center | Get - vm | Get-hard drive | % {if($_.) DiskType - not "Flat") {}
$capacity = $_. CapacityKB/1048576
$sum = $sum + $capacity
Write-Host $_. Name of file $capacity GB
}
}

The problem is that it is not very easy to plugin to the existing script. It seems that I must do a select on a Get view successfully, but I don't know how to get the disc type and the size of the disc from the Get-view. Is there a way documented to do this, or do I have to take an entirely different approach? I have a feeling I'm missing something obvious and just take a look at a few docs...

Thank you

rpmello,

It is easier than you think. The trick is to put the Get-view inside the loop, because you want to use for the calculation instead of $VMView $VM.

Here's how:

##############################
# Script created by Hugo Peeters #
# http://www.peetersonline.nl   #
##############################

# Variables
$VCServerName = "MYVCSERVER"
$CustomFieldName = "RDM Size (GB)"
$ManagedObjectType = "VirtualMachine"

# Script
$VC = Connect-VIServer $VCServerName
$SI = Get-View ServiceInstance
$CFM = Get-View $SI.Content.CustomFieldsManager

$myCustomField = $CFM.Field | Where {$_.Name -eq $CustomFieldName}
If (!$myCustomField)
     {
     # Create Custom Field
     $FieldCopy = $CFM.Field[0]
     $CFM.AddCustomFieldDef($CustomFieldName,$ManagedObjectType,$FieldCopy.FieldDefPrivileges,$FieldCopy.FieldInstancePrivileges)
     }

# Fill Custom Fields
$VMs = Get-VM
ForEach ($VM in $VMs)
     {
     $RDMSize = [math]::Round((($VM | Get-HardDisk | Where {$_.DiskType -ne "flat"} | Measure-Object CapacityKB -Sum).Sum * 1KB / 1GB),0)
     If ($RDMSize )
          {
          $VMView = $VM | Get-View
          # Compare value to current value
          If ($RDMSize -ne ($VMView.CustomValue | ?{$_.Key -eq $myCustomField.Key}).Value)
               {
               # Set Custom Value
               $VMView.setCustomValue($CustomFieldName,$RDMSize )
               }
          }
     }
Disconnect-VIServer -Confirm:$False

Hug

http://www.peetersonline.nl

Tags: VMware

Similar Questions

  • Reconciliation of the IOM is not updating after adding custom fields

    In Oracle Identity Manager 11.1.2 with connector

    Connector for Oracle Internet Directory version 11.1.1

    I close the IOM LDAP users, and after I add custom fields for the reconciliation of the target, and I try to update these users with the new event of reconciliation return of custom fields, this new custom fields poster in case page of reconciliation and not in the form user to LDAP.

    I already create the new form with the news of the custom fields associated with the application Instance.

    Solution:

    CVF (form Version Control Utility) comes with IOM that updates the form associated with existing users.

    With the help of the form Version control utility - 11g Release 2 (11.1.2)

    OR


    Update PROCESS_FORM_TABLE set PROCESS_FORM_TABLE_VERSION =(select SDK_ACTIVE_VERSION of the SDK where SDK_NAME = 'PROCESS_FORM_TABLE'); COMMIT; NOTE: Replace PROCESS_FORM_TABLE with process form real that is 'UD_XXX '.

  • Income of product of opportunity-added custom fields

    Please forgive my ignorance.

    I can't understand how to configure product income the opportunity to add additional fields.


    Help, please!

    When I browse to Admin > App customization > I don't see income opportunity in opp.

    The Type of file you need to edit is back. You will add your fields to the fields of revenue, if necessary. Then you can modify/create the necessary provision using product opportunity revenue layout on the right side.

    You may also change the layouts of opportunity affected to include a new layout. You may also need to update access for roles profiles to ensure adequate access to the data.

    Good luck
    Thom

  • Adding custom Contact list fields

    I noticed that the RIM Windows Live Messenger application has been able to add a custom field in the BlackBerry contacts.

    The field name is "Windows Live Messenger".

    I also want to add a field to all the contacts in the contacts list of BB.  However, I can only find API to change the label of the 4 USER fields and add categories.

    I missed the API correctly, or is adding new contact fields can do something only RIM?

    This can be done using the BlackBerry API defined audience.

  • I added a custom field in my form in British Colombia, but it will not be rendered.

    I added a custom field in my form in BC, but I can't seem to appear whhen I saw it. Anyone know why this is happening?

    Hello

    With Adobe Muse CC 20141, reCaptcha and checkbox field can be added to forms.

    Please install our latest update to try out these new features.

    Release notes | Adobe Muse CC

    Thank you

    Sanjit

  • Why is the size of my pdf increasing after that I added text fields?

    I have a simple pdf which, in itself, is 350 KB. But when I add 4 text fields increases the size of 2.8 mb. Why is this and what can do to decrease the size, but keep the fields of fporm for users to type in?

    Thank you

    Arial is not a standard font. It must be embedded in the file so that it can

    working for others. Try to use Helvetica or Times Roman or Courier.

  • Adding to the custom field hyperlink _blank

    Hello

    I set up a custom field type = LIEN_HYPERTEXTE, this load an anchored in my text. By clicking on this hyperlink opens a new window of the browser as with target = _blank. I can add this property to the tag somehow, like {tag_customfield, _blank} or something?

    Best regards, Dennis

    Nope. You can do it with javascript or a text field and create your own link.

  • Question regarding setExtent and getPreferredWidth for the custom field

    I am trying to understand the difference between getPreferredWidth and setExtent, which relate to the width of a custom field.

    I create a field that may be greater than the width of the screen. The field is made up of cells (for example columns and lines or cells, such as a table). The cells contain text, shapes, lines, color, etc. When I display the field I only paint the visible columns on the screen and allow the user to use the trackball to accomplish the columns out of the screen.

    At present, getPreferredWidth returns the total width of the field without all the empty columns, is longer than the width of the screen. I use the same value in setExtent for width. GetPreferredWidth must return the size of the field that is painted on the screen - the total width less the width of the columns out of the screen? I have the same question about setExtent - width either in total, longer than the screen width or the width of the part of the field that is painted on the screen?

    If I use the width of what is painted on the screen or the other of these methods, then the width changes when the user scrolls through the field. As the user scrolls, I calculate the number of columns will agree to a width of the screen and paint these columns. Is it a problem to have the PreferredWidth and the setExtent change width? I read that setExtent is called only when the Manager sets this field, so that the changes will not be recognized.

    It seems to work in two ways in a few simple tests, but I was just curious as the value of width that is right.

    Thank you!

    Mark

    When a field has changed in a way that requires the update of the screen (for example, after scrolling offset changes), simply call invalidate() from this area. That will eventually lead to paint (Graphics) for the field. At this point, you return the update field. (If only part of a field - as a single cell - needs to be updated, there invalidate() versions that accept arguments where, for efficiency, you can limit the update for just this part.)

    If I understand your needs, you can achieve the effect desired in the paint method. You can use the current dimensions of the field, the cutting of the graphics area, and your internal roll compensates to decide what to paint and what to delete. Let your custom field leave white space where you decide of doesn't make is not part of a cell. There is no need to change the scope of the field.

    If you go about it by changing the dimensions of the field, and then you ask the system to play much more work he has to do. If the custom field is the only field on the screen, it won't make much difference in the behavior (although there may be performance). With more than one field, it can be weird effects. For example, suppose that your custom field is one of several fields in a HorizontalFieldManager and you change the field width. When the HorizontalFieldManager recalculates its own layout, it will change the horizontal position of the fields to the right. The effect on the user, I think, would be really confusing: as the custom field parade, parties to the right of the screen could bounce left and right as the changed width field. I can't imagine that's what you want.

    Here's another way to think about this: absent some bit of style, your custom field would prefer be exactly wide and high enough to show all without scrolling. So the width and height would be based on adding the appropriate cell widths and heights, regardless of what actually is on the display. (It's also a long time that you do not have something fanciful.) If the optimum height is a function of the width available - as with sheathed on the line of text - you would implement this logic in the layout method. You then have no use for autonomous preferred width and height).

  • Question view screen with custom fields

    I've developed a class that extends the scope and Implements DrawStyle. The field contains a bitmap with text drawn on the left of the it... nothing too complicated. I made focasable, has erased layout and drawFocus, painting, etc., but I'm having a Visual anomaly.

    On my screen (no title), I added a LabelField (non-active), and then a BitmapField (non-Focus), followed by a number of my custom fields. When the first screen, everything looks great. My first custom control has focus and is drawn as such.

    The problem occurs when I scroll through the custom control 3rd to 4th (causing the screen scroll), the 2nd custom control appears twice, the 3rd is missing and the 4th has the focus. There are also some white background that starts to show through (my controls are all black and is so the bottom of the screen and other controls).

    Of course, I'm having some trouble of painting, but it is certainly related to scrolling.

    What methods should be overritten in a custom control to ensure the scrolling will work properly?

    Which must be defined in the screen?

    1. prepare your screen unscrollable as:

    Super (NO_VERTICAL_SCROLL);

    2 use a VerticalFieldManager to add all of your components.

    Make sure verticalManager Scrollable and set its size and background color.

    Something like:

            mainManager = new VerticalFieldManager(Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR)
            {
                //setting background color
                protected void paintBackground(Graphics graphics)
                {
                    graphics.setBackgroundColor(0x00000000);
                    graphics.clear();
                    super.paint(graphics);
                }
                //setting its height and width
                protected void sublayout( int maxWidth, int maxHeight )
                {
                    int width = Display.getWidth();
                    int height = Display.getHeight();
                    super.sublayout( width, height);
                    setExtent( width, height);
                }
            };
    

    3. now add this to your screen.

    Now your screen does not scroll and you will not get the white background at the end.

    Let me know if you have any questions.

    Concerning

    Bika

  • drawFocus, drawHighlightRegion & XYRect is equivalent to a white rectangle in a custom field?

    It's one of those days where I should have stayed at home.

    Why the following sets a rectangle white when the false boolean value on?

    In other words, when it put there at the point, I get the highlight of rectangle of color TYellow as expected, when there is no discussion on the custom field (a class that extends the field); a white rectangle is drawn.

    I don't want to take anything either when there is no accent, which is equal to the value Boolean false.

    protected void drawFocus(Graphics graphics, boolean on) {
      paint(graphics);
      if (on) {
        XYRect rect = new XYRect();
        getFocusRect(rect);
        drawHighlightRegion(graphics, HIGHLIGHT_FOCUS, on, 0, 0, w, h);
             int prevColor = graphics.getColor();
         graphics.setColor(Colors.TYellow);
         graphics.drawRect(x, y, w, h);
         graphics.setColor(prevColor);
      }
    }
    

    Good or bad, I solved the problem by following these steps:

    1. My rectangle of drawing in paint with the previous color.
    2. Adding a call to invalidate in the onUnfocus method:
    protected void onUnfocus() {
      invalidate();
    }
    

    If there is a better, I'll be first in line.

  • change the font size in an editable field

    I hunted around and specifically do not find an answer so I hope is not a stupid question.  The threshold between the painting of a custom label field fortunately seems to adjust the size of the text, but between the painting of a custom field activeautotextedit.  What Miss me?  Is there a better way?

    g.setFont (defaultFont.derive (Font.PLAIN, defaultFont.getHeight () + _fontSize));

    Thank you

    Tim

    You want to do this whenever you pass by object it?

    Anyway, if you then a super.paint () to get the text to be printed, the field paint method gets the field fonts.  Then set the font for the field.  You can do this in paint by

    this.setFont (defaultFont.derive (Font.PLAIN, defaultFont.getHeight () + _fontSize));

    but like I said, you really want to do this for each painting?  So, set it for the constructor.

  • Custom field highlighting the problem

    Hello

    I have a custom field class that extends the field.  the custom class allows me to put a photo inside the field.  The problem I have is when I give him a click event, it accentuates not.

    I overrided onUnfocus() drawFocus() onFocus() and object;

    I tried to use super.drawFocus () inside the drawFocus(), tried to use drawHighlightRegion with HIGHLIGHT_SELECT and HIGHLIGHT_FOCUS but no luck.

    Anyone know what I need to do to give hightlight when the user touches the screen, or click?

    OK, so as I said in the previous post, you can paint the blue highlight, but your bitmap image will then paint over clear tones.

    So that the nail is visible, you must set a fill around the bitmap. In other works, the measurement of field must be slightly larger than the size of the bitmap.

    You the best solution would have been to extend BitmapField (rather than field) and use the setSpace() method to set some padding.

    Otherwise, you will need to adjust the measurement of field in your replacement of subLayout().

  • Create a virtual report machine include: Pool of resources with custom fields

    Hello

    I would like to create a VM report that includes the name of the virtual host computer and Discription, as well as the virtual machine Resource Pool belongs too.

    I would also report to query for custom fields, provide the names, values, and to give it in a format that works with export-csv.

    I have a start on the script and it included as an attachment.

    How should I go about adding custom fieldsvalues?

    How can I add the name of the Resource Pool of the report?

    Thank you in advanced for your help.

    Tim

    The problem with the CustomFields, is that I don't know how they are defined on a guest.

    It's a problem when you want to make an Export-Csv thereafter. The cmdlet can handle variable-length items in the table very well.

    That's why I put 1 CustomField in 1 rank.

    $report = @()
    Get-ResourcePool | %{
         $rpName = $_.Name
         $_ | Get-VM | %{
              $vmName = $_.Name
              $_.CustomFields | %{
                   $report += New-Object PSObject -Property @{
                        ResPool = $rpName
                        VM = $vmName
                        CustomName = $_.Key
                        CustomValue = $_.Value
                   }
              }
         }
    }
    $report | Export-Csv "C:\report.csv" -NoTypeInformation -UseCulture
    

    BTW, the Export-Csv cmdlet is a standard cmdlet. Has nothing to do with Dmitri.

    Note that the script in this format requires PowerShell v2 RTM

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • Customizing fields using the BC & DW form builder

    I've created a form, "pre-order" as follows:

    1. CRM > extend CRM database, where I created the CRM data fields
    2. Web Forms > Add Web form > I added the form default CRM 'contacts' fields in the form BC Builder
    3. I then downloaded the form using DW and customize the fields; example: changed "at home" to "delivery address", removed the 'cell phone' field, changed "telephony" to "primary phone"...

    After pressing this form dates back to BC, I tested the form and the fields that I had custom data not in the CRM.

    Can someone help me with this problem?

    Thank you

    Catherine

    Thanks for your reply. In fact the form of CRM data works (data capture to CRM). His section of default contact form, where I customized fields that does not work. I now work with my 3rd BC tech on it as I write this response.

  • CF9/Solr: limitation of the cfindex custom fields

    On CF9, using Solr, I am indexing a database query, but as Verity in the present and previous versions of the CF, there is a limitation on the number of custom fields that I can index.  I know that the limitation is with the cfindex tag Solr is able to index whatever fields are specified in the schema.xml file.

    A solution, I have in mind is to change the schema.xml file by adding all custom fields, I need and can index my content using Solr (post.jar?) instead of cfindex.  The cfsearch tag should return any new fields, not only the more personalized 4.  Has anyone tried to do this?  Should what command I call to index content directly through Solr?

    Alternatively, does anyone else have other suggestions for workaround?

    Thank you

    -Jose

    Depending on your needs, you may be too complicate things.  Simply because that offers only CUSTOM1... CUSTOM4 does not mean that you must only have a subkey by CUSTOMn attribute value.  You can put whatever you want in these values, for example: lists the subkeys; serialized structs or keys, etc.

    I agree that it is less than ideal of how Solr support has been implemented, but you will probably be able to get to work for you in this case.

    --

    Adam

Maybe you are looking for

  • Extreme drop airport utility but the network still doesn't work?

    Hello I hope you can help and I don't know if I'm worried for nothing, but it began to annoy me now. First of all the details of my network are as follows: Cable modem connection cable-> Cat 6 to airport extreme (new model height) which acts as a rou

  • How to convert a c# executable to an executable LabVIEW

    I have a program that was created in c# by an engineer who has left the company.  C# is not widely used among my company, but is LabVIEW so I would like to convert the c# program in a LabVIEW program somehow.  I worked with C language before, but not

  • Dual monitor second dark screen

    I use a Setup dual monitor both monitors same accurate on my pc at the same time on the same exact settings and one of the screens is much darker that the other I tried switching on the cable with no result and have searched the Internet for the past

  • HP App Store fails to install

    I just bought a HP Pre 2 and migrated to a Pixi Plus. I love the Pre 2, but the HP App Store executable fail to install. I hope there is a solution.

  • MEU computador estar lento e vem uma mensagem as erro no windows.

    demora carregar fica trava lento tudo reinicia alone don't demora but uma hora pra carregar quando reinicia falha no windows pode ter sido a problema of causa.