Automate snapshots based on the custom field

I am a newbie to scripting and can't creating a Powershell script that will automatically create snapsht based on a custom attribute that is specified on the virtual computer. I got so far:

Get - VM | Select the custom name fields - ExpandProperty | Where {$_.value - eq "takesnapshot"} | Select name

This gives me a list of virtual machine names that have the specified "takesnapshot" custom field, however, I don't know how to use the output with the Get - VM | New snapshot command to create a new snapshot. Any help would be appreciated.

OK, the key is "Ministry" and the value is "instant".

With the attached line, you should get in the market.

Your test had a few typos: it should be $_ and you should leave out the test to white before the brackets.

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • 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).

  • Two sliders in the custom field definition

    Hi guys,.

    First of all, I want to thank all those who helped me to this day. This forum has been essential for blackberry dev work I do, and I would be screwed without you guys. That being said, I'm having a problem. I install a custom like this text entry field.

    (1) creates a vertical field Manager, assigned a background and resized image with setExtent(). (works fine)

    (2) created a new type of field and inserted in the vertical field Manager to make native look (almost works)

    The problem I have is that two sliders are appearing. Cursor #2 is dynamically updated as it should be, but the #1 cursor seems to be a "flawed slider. Please see the image below for details.

    The custom field is defined using the following code. If I remove the custom field, or cursors comes, so I am positive that it is the source of the problem.

        public class JustifiedEditField extends HorizontalFieldManager implements FieldChangeListener {
            BasicEditField ef;
    
            public JustifiedEditField(long style) {
                super(USE_ALL_WIDTH);
                ef = new BasicEditField(style) {
    
                    protected void onDisplay() {
                        setPosition(10, 17);
                        update(0);
                        //invalidate();
                    }
    
                    protected void update(int d) {
                        super.update(d);
                        setPosition(10, 17);
                        //invalidate();
                    }
    
                    protected void paint(Graphics graphics) {
                        graphics.setColor(Color.WHITE);
                        getFocusRect(new XYRect());
                        drawFocus(graphics, true);
                        super.paint(graphics);
                    }
    
                    protected void onUnfocus() {
                        invalidate();
                    }
    
                    protected void onFocus(int direction) {
                        invalidate();
                    }
    
                    /**
                     * Intercepts ESCAPE key.
                     * @see net.rim.device.api.ui.component.TextField#keyChar(char,int,int)
                     */
                    protected boolean keyChar(char ch, int status, int time) {
                        switch(ch) {
                            case Characters.ESCAPE:
                                // Clear keyword.
                                if(super.getTextLength() > 0)
                                {
                                    setText("");
                                    return true;
                                }
                        }
                        return super.keyChar(ch, status, time);
                    }
                };
                add(ef);
            }
    
            protected void sublayout(int width, int height) {
                super.sublayout(width, height);
                setExtent(width, 57);
            }
    
            public BasicEditField getEditField() {
                return ef;
            }
    
            public String getText() {
                return ef.getText();
            }
    
            public void setText(String value) {
                ef.setText(value);
                invalidate();
            }
    
            public void setChangeListener(FieldChangeListener changer ){
                ef.setChangeListener(changer);
            }
    
            public void fieldChanged(Field field, int context) {
                invalidate();
            }
        }
    

    I am totally stuck on this issue, any help would be really appreciated. TIA!

    I came up with an alternative solution. It turns out that I can use a transparent border to set the offsets to where the edit field must be located within the input Manager; thus eliminating the need to use setPosition.

  • Part of the cursor remains in the custom field

    Hello, guys!

    I have a problem.

    In the custom field that extends EditField, I want to draw in the text and the image and draw an appropriate in the cursor position. Then, we thought it would only calculate in advance of the police and the width of the image in the paint method to display the text and image and to the similar development and I tried. However, the cursor drawing is wrong. When the cursor moves from right to left, a part of the slider to the position immediately before the rest.

    Y at - it a good solution?

    JDE component package: 4.6.0

    I solved by myself.

    'FocusChangeListener' is mounted with EditField. And "invalidate()" has been called in the method "focusChanged().

    It became a great result for me.

    Thank you.

  • How long does it take for the custom field created in SFDC appears in the list of field mapping?

    How long does it take for the custom field created in SFDC appears in the list of field mapping? I hit the refresh field button, but it does not appear after 5 min. I just need to have patience?

    I had the same problem yesterday, I think it took about 10-15 minutes to appear.

  • PowerCLI script retrieve vmname based on the value of the custom field

    I want to retrieve a set of virtual machine based on a custom attribute names.  I have a custom field called alert level and I want to list only servers with an alert level of 4 so that I can automatically turn them off during a power failure.

    That's what I have so far:

    Get - VM | Select Name -ExpandProperty CustomFields | {$_.key -eq "Alert Level"} | {$_.value -eq 4}

    This seems to me the namem, field and value but all I want is the name.

    Any ideas?

    Try this

    Get - VM | where {$_.} {CustomFields ["warning level" ""]- eq 4} | Select the name of


  • The use of javascript to save a pdf file in a different directory and generating a new file based on the form fields in the document name.

    I built the following script to create a submit button that will automatically save the document in a different directory on my computer. It will also use data form 'customer' field and 'date' to generate the file name. I printed the myPath variable, and it seems that he printed the correct string. I get the following error:

    TypeError: redeclaration of const path

    any help would be appreciated.

    var customer = this.getField("Customer").value;

    var date = this.getField("Date").value;

    var path = "C:/users/lead/My Documents/Test / '.

    Reg = date.match(/(\d+)\/(\d+)\/(\d+)/ var);

    var myPath = "C:/users/lead/My Documents/Test /" client + '_' + reg [1] + "." + reg [2] + "." +

    Reg [3] + ".pdf";

    this.saveAs (myPath);

    Thank you. It turns out that simply remove this additional path variable does the job. I used that in an earlier version of my code and I forgot that this is. My syntax also seems to be right.

  • Get e-mail addresses to automatically set up in the To: field of a Windows Mail

    I'm trying to find how to get the familiar e-mail addresses I type into the To: field for new messages in Windows Mail to automatically mount when I type in the first few letters.

    Currently, it doesn't seem to store e-mail addresses, I used for a few days in his memory, regardless of if it is stored in my address book, which means that I am forever having to type the e-mail address in its entirety, or continue to go in the AddressBook to dig up people. It would be much simpler that the system can be affected to recognize my typing more permanently!

    Can anyone help?

    I'm not sure you really understand what Shawn said.
    These are called "semi-automatic", it's NOT what it really is.
    It can ONLY semi-automatic 29 RECENT addresses you had USED.
    All other addresses beyond the list of 29 will NOT get auto-compleyed for those who are NOT in the list.
    The ONLY way to get these beyond the list of 29 to knock on button, scroll to find the address or type the first letter or 2 in the search box.

    You can consider installing Windows Live Mail, which will OFFER a semi-automatic TO your address book.
    Windows Live Mail and Windows Mail will co-exist. You don't have to give up one.

    t-4-2

  • Background color of the custom field

    Hello

    I create a custom field that is as shown in the attached display a bar graph.

    I don't want to change the background color of the field of another color. I tried to overridding method paintBackground of the field as shown below:

    protected void paintBackground(Graphics arg0) {
            arg0.setColor(Color.DARKGRAY);
            super.paintBackground(arg0);
        }
    

    but it seems to have no effect. Could someone kindly help me with this. Thanks in advance.

    Kind regards

    S.A.Norton Stanley

    Try this...

    Create a class that extends the scope and implements DrawStyle

    and override its Paint method... to set the background color

    Draw the shape you want with the graphics object and either fill the area or set the background color.

    THX

    Rabi Ray

  • Drawing Bitmap on the custom field

    If I have a custom component that extends the scope I am able to draw Bitmap on it?

    I try to shoot in object overrided method in this way.

     protected void paint(Graphics g)    {         Bitmap = Bitmap.getBitmapResource("test.bmp");        if(picture != null)            g.drawBitmap(getPreferredWidth()+5,                          getPreferredHeight() + 5,                          picture.getWidth(),                          picture.getHeight(),                         picture,                          0,                          0);
    
        }
    

    But no picture on my component.  Specified test.bmp exists as a resource and object Bitmap appears correctly. No exceptions occur.

    Any comments? Maybe it's impossible to draw a bitmap on component expanded in such a way?

    Thanks in advance.

    Thanks for your suggestion. The problem wasn't in extention but in the region of destination, top and left. X and there were calculated with respect to the top and left of the main screen instead of top and left of the custom my field.

    Your message dropped a hint on how to survey. Thank you very much!

  • typed letters are not visible after the end of the custom field in editfield

    class CustomEditField extends EditField {}

    CustomEditField (String text) {}

    Super("",Text);

    }

    public void layout (int width, int height) {}

    Super.Layout (getPreferredWidth (), getPreferredHeight ());

    setExtent (getPreferredWidth (), getPreferredHeight ());

    }

    public int getPreferredHeight() {}

    Return super.getPreferredHeight ();

    }

    public int getPreferredWidth() {}

    return (Display.getWidth () * 2/3);

    }

    }

    It's my edit custom field.

    When I type on this field and reached end of the field, can't see the letters after that, but I can type (the only thing is to type letters are not visible after the end of the field)

    What is the solution

    I'm sure that you must explicitly enable scrolling. See Manager javadocs.

    In addition, you limit the scope of your field, which may also fail to scroll.

  • SX80 and automatic switching based on the mic input camera

    Please can someone confirm that the SX80 is able to switch camera entries automatically based on the microphone the highest entry level?

    That's what the "Audio input Microphone [1-8] VideoAssociation VideoInputSource: [1...» [5]"command is for, no?

    Is there something else to make it work?

    Thank you.

    Is the correct answer of Acevirgil. The other way outside the SpeakerTrack is with a control mixer and microphone of third party.

    It is very difficult to do things, with the 'right', which means the following

    • The switch happens as soon as the conversation
    • Each switch takes exactly the same amount of time
    • Only concentrated no panoramic, not tilting, video non-zoom is sent to complete far or near end view
    • Logic manages several open mics or prevent it from happening
    • Should handle non-English periods gracefully with views of appropriate camera - i.e. without open mics
    • ignore the random noises, paper, phone, door open, outside the irrelevant sounds, etc...

    There are about more than a dozen, but those are the most important. Out of all that I've seen on the soundtrack is by far the best of the OEM. It fails on some of the points above, but doing good things.

  • Create the custom field on vm creation

    Hi all!

    Does anyone know if there is a way to create a custom field in each new virtual machine with the news of creation (Date/time and user)? I was thinking about a trigger in the vCenter but still lost in this...

    See Alan poster called runs a scheduled job PowerCLI

  • How to set the custom fields in the form submission email?

    Here's what I mean...

    Here is a screenshot of the form online for my client. Most of these fields are "custom".

    Screen Shot 2015-02-27 at 9.41.50 AM.png

    Here's an email from test of what the email looks like when it come in.

    Screen Shot 2015-02-27 at 9.41.25 AM.png

    As you can see all my custom fields list as just that, custom.

    When a patient fills this out it is difficult to say what it applies to that.

    How do I change these fields that say "customized" to say what really is the field?

    Hello

    It appears that you have disabled the 'label' for each custom field.

    Please select the field and go voluntarily, as shown in the screenshot.

    Please check the 'label' > shoe, this will be you the label to the form field as "Custom", rename it according to your requirement and disable the label again.

    Re-upload the site and you should be all set.

    Concerning

    Vivek

  • Displacement of the custom fields of one vCenter to another

    Hello

    I need to move my vcenter (or all esx hosts) of my new vsphere vcenter. I connect just 3.5 esx host for my new vcenter.

    as for this nice guide iam able to move old vcenter custom fields to my vcenter vsphere using export-csv.

    http://www.virtu-al.NET/2009/05/29/PowerCLI-on-steroids-custom-attributes/

    -


    Snip-


    Snip
    Snip

    Snip
    -.

    1. The export of all the attributes that have been customized in a CSV (backup)

    $list = @)

    $vmArray.GetEnumerator () | %{

    $vmName = $_. Name

    $_. Value.Custom.getenumerator () | %{

    $row = New-Object psobject

    $row | Add-Member - memberType noteproperty-name VmName-value $vmName

    $row | Add-Member - memberType noteproperty-name NomAC-value $customKeyLookup [http://$_.Name|http://$_.Name]

    $row | Add-Member - memberType noteproperty-name CAValue-value of $_. Value

    $list = $row

    }

    }

    $liste | Export-Csv "C:\CA-backup.csv" - noTypeInformation

    -


    Snip-


    Snip
    Snip

    Snip

    Snip
    -.

    so I connect vi PowerCli to my old vcenter 'connect-viserver' and export all of the CF, "reconnect" all the esx 3.5 to my vsphere vcenter server, connect to my new vcenter and import them accordingly:

    -


    Snip-


    Snip
    Snip

    Snip

    Snip
    -.

    1. Import all custom from a CSV (restore) file attributes

    Import-Csv "C:\CA-backup.csv" | %{

    $vmArray [http://$_.VmName|http://$_.VmName]. Object.setCustomValue ($_.) NomAC, $_. CAValue( )

    }

    -


    Snip-


    Snip
    Snip

    Snip

    Snip
    -.

    I can't run this code as a script itself snippets and my PS skills are limited, so here's my Question: could someone help me to get started?

    I guess I need to plug my vCenter first... as "Connect-VIServer vcserver.

    your help is very appreciated. Thank you

    rgrds uxmax

    Hi, thanks for the link

    Yes, you will need to connect to your server of VI using the cmdlet connect-viserver, something like this should do:

    to connect-viserver MYVISERVER

    Or if you need to move from other credentails as the account that you are using this as a use:

    SE connect-viserver MYVISERVER-user "myuser" - pass "myP@ssword"

    Once you have done this, you can run the export and then use the same cmdlet to connect to the other server of VI before importing the details.

    I hope this helps.  As a no, I also activated on my blog comments, it's a good way for everyone to see, too, how solve us problems.

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

    Alan Renouf

    http://Virtu-al.NET

Maybe you are looking for

  • Satellite A40: keyboard mapping with us Euro WinXP Pro

    I thought it was a simple problem to solve, but unfortunately it has escaped me. I had to reload a Satellite A40 with the American version of WinXP Pro Corp. Laptop was purchased in Germany. The keyboard is physically different than typical laptops,

  • Pavilion 15-n092sa: replacement of keyboard (urgent)

    So after you spill a few drops of tea on my keyboard, it no longer works (for the most part). Individuals: -Some keys do not respond when you press -If the buttons respond, they tend to relate to different characters (the C key is now my space bar) -

  • Network Diagnostics says "connection to the local network 2 has no valid ip address.

    Dear Sir/Madam, I use the computer dell laptop windows 7 Home premium 64-bit. Usually, I connect my laptop to the internet through wifi modem. It connects automatically to him and there is no problem. But suddenly, the connection is not showing this

  • How to install W7 on a new hard drive with an upgrade disc

    This issue was published and responded differently and I'm looking to help determine that I'm not just doing. I have a desktop dell Inspiron 540 initially installed with vista and upgraded to w7 with upgrade disk.  PC currently has a raid 0 on two dr

  • p6203w M/N - 250 Watt power supply, to be upgraded.

    This model slimline I, p6203w, contains a small 250 Watt PSU.  I want to improve, but I fear that the new power supply may be too much physically. I know that I could just leave it outside the PC, but I prefer to have it mounted properly.  Are there