Problem with where / contains

I'm trying to generate a list of virtual machines based on the computers of the AD.  The first example works very well and I suppose because $group is a string.  The second in which $group generated by a query AD does not work.  How to convert $group in this case to work with - contains or is at - it another way to structure that?

$group = "SQL02","SQL04"
get-vm | where {$group -contains $_.name}


$group = Get-ADComputer -Filter 'Name -like "SQL"' | select-object -property name
get-vm | where {$group -contains $_.name}



Dave

VMware communities user moderator

Now available - vSphere Quick Start Guide

You have a system or a PCI with VMDirectPath?  Submit your specifications to Officieux VMDirectPath HCL.

The Select-Object cmdlet does not return a string but an object. You can check by channeling the output to the Get-Member cmdlet.

Get-ADComputer -Filter 'Name -like "SQL"' | select-object -property name | Get-Member

With the - contains operator you then compare a string against a collection of objects.

That won't work.

You could do

$group = Get-ADComputer -Filter 'Name -like "SQL"' | %{$_.Name}
get-vm | where {$group -contains $_.name}

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • squiggly_p4, problem with Spark container

    Hello

    Environment: Flex SDK 4.5 Hero, Win7 64-bit, Flash Builder 4

    Code snippet

    < s:Panel >

    < mx:TextArea id = "myTextArea" width = "300" height = "200" / >

    < / s:Panel >

    < s:TitleWindow >

    < mx:TextArea id = "myTextArea" width = "300" height = "200" / >

    < / s:TitleWindow >

    Result:

    There is no suggestion for thos Halo TextArea if it belongs to the container of the spark.

    Capture.PNG

    Capture2.PNG

    Maybe: ContextMenu is uninitialized or not properly initialized.

    Thank you

    Jing

    It is a known problem with the panels of the spark. Please refer to http://forums.adobe.com/thread/706416?tstart=0

    Thank you

    Ravi

  • Body of function from PL/SQL query SQL - problem with where Cluase return

    Hi all
    I have problem with sub PL/SQL. Where clause does not filter the values even when I change the value: P7_INVESTIGATOR. I have marked with an asterisk for where clause where I want the values to filtered.


    DECLARE
    v_sql varchar2 (5000);
    v_inv VARCHAR2 (100);

    Start
    v_inv: = UPPER(:P7_INVESTIGATOR);

    v_sql: = ' select TBLCASES. INVESTIGATOR as an INVESTIGATOR,';
    v_sql: = v_sql | "TBLCASES. CASENUMBER as CASENUMBER,';
    v_sql: = v_sql | "TBLCASES. OPENDATE as OPENDATE,';
    v_sql: = v_sql | "TBLCASES. ESTCOMPLETE as DATE_CIBLE,';
    v_sql: = v_sql | "TBLCASES. STATUS of STATUS ';
    v_sql: = v_sql | "TBLCASES. Case CODE case CODE as,';
    v_sql: = V_sql | "TBLCASES. FAIR_HOTLINE as FAIRHotline,';
    v_sql: = v_sql | "TBLCASES. NYSIG as NYSIGCase,';
    v_sql: = v_sql | "TBLCASES. The REGION';
    v_sql: = v_sql | "TBLCASES. PROGAREA as PROGArea ';
    v_sql: = v_sql | ' from TBLCASES where 1 = 1';
    **************************************************************
    If v_inv <>null then
    v_sql
    : = v_sql | "and UPPER (trim (tblcases.investigator)) = UPPER (trim (v_inv))';
    END IF;
    ***************************************************************
    v_sql: = v_sql | "order by tblcases.investigator";
    Return v_sql;
    end;


    Thank you

    wrote:
    Or it is possible to write it this way:

    if v_inv is not null then
    v_sql := v_sql ||'  and UPPER(trim(tblcases.investigator)) = UPPER(trim(:P7_INVESTIGATOR))';
    END IF ;
    

    In this case we will use bind variables and we all know that it is very important.

    Lev

    Of cause, it is the best option. and I strongly suggest the OP to use.
    But it depends on how the sql is used later.
    Without knowing that, we cannot be sure if the item is available here.

  • Problems with values () .contains () and containsValue() to NamedCache

    Hi all

    We will store the objects in a distributed cache (version 3.3) using objects versionnables for optimistic locking. Objects stored in the cache are anti-theft with POF. However, it seems that for values () .contains () and containsValue(), equals() is never called on these objects. The problem we have is that to implement versionnables, we use a field long version, but I deliberately don't compare this field in equals(). However, this means that if I have an object, insert it into the cache and immediately call containsValue() return false(). As far as I know use of the debugger, it seems calling equals() directly on the binary object stored in the cache, which is almost never what you want.

    Y at - it a good solution for this?

    See you soon,.
    Colin

    I would like to raise objection: that's almost ALWAYS what you want because otherwise, data must be deserialized each time put or get important takes place resulting in a drop in performance!

    From my experience, it's ok to compare the form serialized about 99.5% of the time. In the rare cases were you really want to do something special in the equals method, it is of course a royal pain in the XXX that it is made this way...

    Otherwise, you're right - this is how it works!

    Best regards
    Magnus

  • Problem with cluster containing different objects!

    Hello to all 2!

    Here's what I'm trying to do:

    -J' have a group of 3 elements: 2 Boolean and 1 controls arrow.

    -I want to display all the objects in the cluster and disappear in sequential order: Boolean - invisible; arrow - invisible, Boolean - visible; arrow-visible, invisible 2 - Boolean and so on.

    I have attached a vi in which I tried to address this issue, but without success.

    Any ideas?

    Thank you very much!

    Andrew.

    Andrew,

    Make the arrow a Boolean control with an image of an arrow.  Then, all the controls are Boolean values, and visibility can be controlled by a simple loop.

    Lynn

  • Problem with form container tut. 2.1

    Here is my code:
    < mx:Form = "439" x = "10".
    width = "318" height = "349".
    borderStyle = "solid" borderColor = "#d4d4d4."
    dropShadowEnabled = 'true' dropShadowColor = "#b3b3b3."
    shadowDirection = 'right' shadowDistance = "10" >

    < mx:FormHeading label = "Contact Information" / >
    < mx:FormItem label = "full name:" >
    < mx:TextInput id = "name" / >
    < / mx:FormItem >
    < mx:FormItem id = "address:" >
    < mx:TextInput id = "address" / >
    < / mx:FormItem >
    < mx:FormItem id = "City:" >
    < mx:TextInput id = "City" / >
    < / mx:FormItem >
    < mx:FormItem id = "State:" >
    < mx:TextInput id = "State" / >
    < / mx:FormItem >
    < mx:FormItem id = "ZIP Code:" >
    < mx:TextInput id = 'postal code' / >
    < / mx:FormItem >
    < mx:FormItem id = "phone:" >
    < mx:TextInput id = "phone" / >
    < / mx:FormItem >
    < mx:FormHeading label = "Room Information" / >
    < mx:FormItem label = 'Date needed' >
    < mx:DateField id = "dateNeeded" / >
    < / mx:FormItem >
    < mx:FormItem >
    < mx:Button label = "Submit" id = "Button" / >
    < / mx:FormItem >
    < / mx:Form >

    But the FullName text entry. Am I blind? I don't see my error...

    Looks like the problem is that you are missing the attribute 'label' for the FormItems following the element name. You have 'ID' instead of the label.

  • Anyone having problems with the last Flash?

    Update of Flash and Java yesterday, and since then had problems with plugin container closure etc.

    Slowly began to disable add-on first and then this morning off Flash since Chrome was having a similar problem.

    No more problems and helped all add them we...

    Thoughts anyone?

    http://support.Mozilla.org/en-us/KB/reset-Firefox-easily-fix-most-problems

    Reset worked for me

  • Hello, I have a problem with Mozilla Firefox 14 and now also Firefox 15. When I click on .html files on my desktop, firefox will open a new window twice. Where is the th

    Hello, I have a problem with Mozilla Firefox 14 and now also Firefox 15. When I click on .html files on my desktop, firefox will open a new window twice. Where is the problem? Thank you

    That may be a problem with the DDE.

    Try to undo and redo Firefox as default browser.

    Make a different browser like IE browser by default and then let Firefox do it again.

    See:

  • Have a problem with the Windows XP where he did not finish the boot.

    Have a problem with the Windows XP where he did not finish the boot. Ran remote console and @ the c: > guest tried to run chkdsk/r/p and received the error message "invaild drive. I put the drive in the argument?

    Hello Tmagic,

    Thank you for your message.  The correct format is below:
    chkdsk volume: (switches, e.g./r/p)

    example: chkdsk c: /r /p

    If these results find but cannot fix all the mistakes, you can also check with the manufacturer of your drive and possibly download a utility that will check the errors and repairs.
    Please let us know if it did or did not help to solve your problem.
    See you soon

    Engineer Jason Microsoft Support answers visit our Microsoft answers feedback Forum and let us know what you think.

  • Where can I find as the screenshot I captured of a pop-up that is causing problems with Internet Explorer?

    I took a screen shot of a pop-up, so I me advise about this pop up, but now I can find it. Where can I find the screenshot? I looked in my documents as well as photos, but he isn't here? I need to find the screen shot to get help with it because I had big problems with Internet explore all day today and this pop-up started yesterday.

    Thanks for any help I can get.

    Linda

    Original title: screenshot

    I took a screen shot of a pop-up, so I me advise about this pop up, but now I can find it. Where can I find the screenshot? I looked in my documents as well as photos, but he isn't here? I need to find the screen shot to get help with it because I had big problems with Internet explore all day today and this pop-up started yesterday.

    Thanks for any help I can get.

    Linda

    Hi Linda

    Take a screenshot in Windows 7 requires several actions.

    1. press the Printscreen key. This operation copies an image of the screen to the Clipboard.

    2. open an imaging program such as MS Paint and paste the screenshot.

    3 save the screenshot image in a folder of your choice.

    Concerning

  • Windows 7 laptop. I have problems with my cursor. When I type, it jumps and anywhere else except where I type moves.

    Hello:

    I am pleased to say that I have really only one problem left to solve.  I have a Dell Inspiron N5010 with Windows 7.  I started having this problem immediately about two or three weeks after the purchase of this computer.  I have problems with my cursor.  A Laptop store owner who corrects laptops told me ' you type you're probably hit a key that throws the slider out where you type and be aware of this.  I really don't think that.

    Is that the problem is that whenever I type just arbitrarily the cursor jump to other sections of my screen where I previously typed something.  It's very frustrating.  Can you really fix that because a tech support person told me that "which cannot really be fixed with someone to take control of your computer, or there is a problem with the keyboard".  That's what he says.  "It could be a problem with the keyboard" and he concluded that it might have to be taken in a store or (sent to DELL (and I say no, no, no (Amy Whinehouse)).)  A lot of smiles.

    But in any case this problem can be corrected as any other problem?  I hate it when this cursor jumps around on the screen to the typed sections previously.  It does not have it on my desk.

    Please let me know.

    Lavenderjade

    Hello

    1. the problem occurs with any particular application or all applications?
    2. don't you make changes to the computer before the show?

    Method 1
    The issue may be due to some third-party program conflicts. I suggest you perform the clean boot and check if the problem persists.

    How to troubleshoot a problem by performing a clean boot in Windows Vista or in Windows 7
    http://support.Microsoft.com/kb/929135
    Note: Follow step 7 clean boot KB929135 article to reset the computer in normal mode.

    Method 2
    I suggest that you try to reduce the sensitivity of the touchpad and check if that helps.

    a. turn on your computer and log in to Windows as usual. Open the "Start" menu and click on the "Control Panel" option.

    b. double-click the icon named "Mouse"... The "Mouse properties" window opens. Go to the tab "device settings". Click on the button "settings". A window titled "Properties" appears.

    c. examine the left panel of the 'Properties' window and expand the option "sensitivity." Click on the option "Sensitivity to touch."

    d. reduce tactile sensitivity in moving the slider to the right, to the label of "heavy touch. Experiment with different levels of sensitivity until find you one suited to your needs.

    e. click the 'OK' button to close the "Properties" window Repeat the operation with the control panel "mouse". Your new touchpad sensitivity settings are now saved.

    Method 3
    I suggest you to update the drivers for the touchpad on the manufacturers Web site.
    http://www.Dell.com/support/drivers/us/en/555

    More information
    Mouse, touchpad and keyboard with Windows problems
    http://Windows.Microsoft.com/en-us/Windows/help/Mouse-touchpad-and-keyboard-problems-in-Windows?T1=tab04

  • I have problems with setting up my Gmail in my room light 6 mL, where do you think I could get help for this?

    I have problems with setting up my Gmail in my room light 6 mL, where do you think I could get help for this?

    Hi kikikilala,

    Please explain the problem you are oriented connect Gmail with Lightroom

    Try reauthorizing your Gmail account once in Lightroom and see if that helps.

    Refer to Validation of Gmail failure

    Kind regards

    Assani

  • Since Acrobat Reader downloaded DC I can't sign my PDF documents. It does not give me the option more and yes I am connected. On the old version, I got no problem with clicking on "signature" and draw the area where I needed my signature, put passw

    Since Acrobat Reader downloaded DC I can't sign my PDF documents. It does not give me the option more and yes I am connected. On the old version, I got no problem with clicking on "signature" and draw the area where I needed my signature, put the password and "POOF" my signature would be there. With this new version, it won't do that or give me the option. The online help is useless. I need to explain to me how connect you as I used too?

    Hi nicholass35183848,

    I assumed that you had a digital signature created in your player application of old and whenever you use to fill out a pdf with a signature field signed you it. But in order to draw and then sign you must use Acrobat Pro DC no DC drive.

    Thank you

    Abhishek

  • Hello, I had a problem with my band. It does not really suppose he numbered scenes everything in order and he has so far in until I missed an and changed for the good order. But now when I go back to where I left and I have create a new scene

    Hello, I had a problem with my band. It does not really suppose he numbered scenes everything in order and he has so far in until I missed an and changed for the good order. But now when I go back to where I left and I have create a new scene number come up as * it and I need to change personally. is their any way I can change it to order normally?

    Hello

    You can manage this through the "Manage scene numbers" option in the menu 'Production '.

    There is a setting in this dialog box to assign scene numbers automatically to the new scenes.

  • How do I monitor/find where is the State of my download?  I don't know how long it takes or if there is a problem with the download that I can't find anything.  Also, is it supposed to be an icon for my purchase of Photoshop and light in my apps folder

    How do I monitor/find where is the State of my download?  I don't know how long it takes or if there is a problem with the download that I can't find anything.  Also, is it supposed to be an icon for my purchase of Photoshop and light in my apps folder?  Where can I find that when it's done download?

    Could you please confirm the operating system you are using.

    You can see the status of the application of CC desktop download.

    The CC app desktop click the creative cloud icon located in the taskbar (Windows) or the Apple bar (Mac OS) menu, to open the creative cloud desktop application.

    Hope this will help you.

    Kind regards

    Hervé Khare

Maybe you are looking for

  • Satellite A210-1AO: sometimes the colors on the screen become unnatural

    Hello. I have a Toshiba Satellite A210 1AO two months ago and collided with a following problem.Very rarely (once a week) on the screen colors become suddenly against natural.The problem even if it means opening / closing of coverage. Really the mate

  • Webcam Chicony USB 2.0 & Satellite L300D-11V

    Hello I just installed Windows 7 Professional in my laptop Toshiba Satellite L300D-11V.Everything is reported as working in the Device Manager, but the driver of the webcam Chicony does not start. Windows automatically installs the drivers, v.6.1.760

  • How can I fix the State of the media - media disconnected?

    I have a laptop that is running Windows XP, and I'm having problems connecting to the Internet and my router. I have another laptop running Windows 7, which connects well, including mobile phones and game consoles that can still connect to the router

  • Windows XP, keep get knocked offline

    I kee4p get knocked offline, this isn't my provider (through 3 different modems workin very well).Yahoo.comchesscube.com all the 4 I'm knocked offlinePogo.comSTOPzilla.com

  • Failed to open the e-pub downloads directly into the PC.

    I have a number of e-book downloads that I copy then to the caliber, then to my e-reader. It works fine but if I try to open a file directly to download nothing happens! I'm entirely self-taught, so there are MANY, I do not understand esp.  on the fi