Question of Where-Object

Hello

I tried to understand what I'm doing wrong here, to try to filter a naa.6b whatever it is this script.

All my other LUNS start with naa.600, so I want only the 60 and not 6 b, for my release.

Claire

New-VIProperty-name lunDatastoreName - ObjectType ScsiLun-Value {}

Param ($LUN)

$ds = $lun. VMHost.ExtensionData.Datastore | % {Get-view $_} | `

where {$_.} Summary.Type - eq "VMFS" - and

(_.Info.Vmfs.Extent $ |) where {$_.} DiskName - eq $lun. CanonicalName - and $_. DiskName - don't "naa.6b*"})}

{if ($DS)}

$ds. Name

}

} - Force | Out-Null

$esxName = "esxi1.lab.local".

Get-VMHost $esxName | Get-ScsiLun | Monday Select, lunDatastoreName, CanonicalName, CapacityMB | Monday tri

He comes to the line, I worked on:

(_.Info.Vmfs.Extent $ |) where {$_.} DiskName - eq $lun. CanonicalName - and $_. DiskName - don't "naa.6b*"})}

Thanks for your help,

-Mike

In fact, I think that it does not work as expected is added to the property with the calculated value. It calculates a value $null for these LUNs. Have you checked this LUN will return the name of the data store when you look at it manually?

Tags: VMware

Similar Questions

  • The simple question is "where can I find the installer for the HP Quick start?

    The simple question is "where can I find the installer for the HP Quick start?

    BESR regards

    Hello:

    And here's one for W8...

    http://h20565.www2.HP.com/hpsc/SWD/public/detail?swItemId=ob_140915_1#tab1

  • Unable to set server 2012 without the protocol driver LLDP Microsoft network adapter. I have searched the driver but had no chance. My question is where is it located on the CD-ROM of the 2012 Server

    Unable to set server 2012 without the protocol driver LLDP Microsoft network adapter. I have searched the driver but had no chance. My question is where is it located on the CD-ROM of the 2012 Server? I use the version standard edition. Thanks for any advice.

    Thank you all.

    John Hayes

    Hello

    The question you posted would be better supported in the TechNet Forums. I suggest you to ask your question in the TechNet Forums.

    http://social.technet.Microsoft.com/forums/en-us/categories/

    Thank you

  • Get disc using Where-Object sizes

    Hey guys,.

    Im doing something really wrong here, but every time I run this command, all I get is maybe the VM property:

    $VM | Where-Object {($_.)} Guest.Disks | Where-Object {$_.} Path - eq "C:\". »}). CapacityGB}

    Any thoughts?

    You can.

    First loop through all the virtual machines in the $VM variable, and then extract the object that represents the C partition in the $a variable.

    Once done, access you the properties through the $a variable

    $VM | %{

    $a = $_. Guest.Disks | Where-Object {$_.} Path - eq "C:\". »}

    $a.CapacityGB

    }

  • Try to resize C:\ on preproduction servers that are less than 59 GB using several Where-Object checks

    Hi people

    Im trying to increase all disks C:\ of different sizes for a uniform 60 GB.

    I found a thread in this community that attempts to automate it as follows:

    Get-hard drive - vm "my VM | where {$_.} Name - eq 'disk 1'} | Together-hard drive - CapacityGB 60 - ResizeGuestPartition-confirm: $false

    To confirm, the command works but the ResizeGuestPartition does not work, so I need to automate this later.

    For now the key is to get this working and it does not appear:

    Get-VM-Tag "preproduction" | Where-Object {$_.} Guest.OSFullName - like ' * Windows Server * "- and $_. PowerState - eq 'Receptor' - and ($_.) Guest.Disks.Path - eq "C:\". "- and $_. Guest.Disks.CapacityGB - lt 59)}

    Im trying to figure out how to use a hash table / script block to tell if the disc is "C:\". "and the size of this drive is less than 59 GB, then resize the disk. Before I resize the disks, I need to validate the im servers get back are indeed correct - for the moment, they are not as I checked inspected these variables manually through PowerGUI (excellent by the way).

    Even if I'm just trying to Get-VM-Tag "preproduction" | Where-Object {$_.} Guest.Disks.Path - eq "C:\". "- and $_. Guest.Disks.CapacityGB - lt 59} the result does not work and I think that its because it detects all the disks and then said there is at least one drive which is equal to "C:\". "and at least a drive that is less"Go 59 -"but I need it to be the same disk not different disks for obvious reasons, otherwise the result will always be wrong.

    LucD im sure you meet a reading, I would really appreciate your help

    Im trying to start searching for a cleaner steamer so that I don't have to run several lines of code to achieve the same.

    Much appreciated,

    Mike

    Try like this

    Get-VM-Tag "preproduction" |

    Where-Object {$_.} Guest.OSFullName - like ' * Windows Server * '- and

    $_. PowerState - eq 'Receptor' - and

    (($_. Guest.Disks | where {$_.} Path - eq "C:\". »}). (CapacityGB-le 59)} |

    Select name

  • Need help getting the Where-Object filter in the right place

    Hello

    I'm trying to filter local data warehouses, but I do not get the expected results.

    Code:

    Get-Datastore. Select @{N = "MON"; E={$_. Name}},

    @{N = "Total virtual machines"; E={@($_ | Get - VM). County}} |

    Where-Object {$_Name-Notlike "Datastore1 *"}

    Thank you

    As a general rule, you want to first filter when it is possible for greater efficiency in the pipeline.  Which is no exception here:

    Try:

    Get-Datastore. Where-Object {$_Name-Notlike "Datastore1 *"} |

    Select @{N = "MON"; E={$_. Name}}, @{N = "Total virtual machines"; E={@($_ | Get - VM). County}}

  • Trajectories of load balance LUNS, Where-Object error

    Greetings,

    I started to modify the script to:

    http://vmjunkie.WordPress.com/2009/01/29/balancing-LUN-paths-on-your-ESX-hosts-with-PowerShell/

    to adapt to our environment. We have our similar to VM LUN LUN labeled utility, but they do not have the same number of paths. Here are the instruction select where-object that I use:

    SNIP script:

    $luns = $VMHost | get-scsilun - luntype disc |

    WHERE-object {$_.} {ConsoleDeviceName-like ' / vmfs/devices/drives/vml * "} |

    WHERE-object {$_.} {CanonicalName as "vmhba0:0: *"} | CanonicalName sort-Object

    $firstLUNPaths = get-ScsiLunPath $lun [0]

    $numPaths = $firstLUNPaths.Length

    The script works very well on the first host in the cluster, but I get this error on each host subsequently:

    Err:

    Impossible to index in an object of type VMware.VimAutomation.Client20.Host.ScsiLunImpl.

    C:\hp\Tools\VM_Tools\Scripts\Pathing\Set_Cluster_SAN_Path_t.ps1:37 tank: 40

    + $firstLUNPaths = get-ScsiLunPath $lun [0 & lt; & lt; & lt; & lt;]

    Line 37 is:

    $firstLUNPaths = get-ScsiLunPath $lun [0]

    If I remove the part of the select statement:

    WHERE-object {$_.} {CanonicalName as "vmhba0:0: *"}

    The error disappears. Since it is part of the select statement that gets the VM LUN I really it works.

    Thanks in advance!

    Kevin

    Are you sure that $lun is a table when you get the error?

    Maybe there is only 1 object of ScsiLunImpl. Where the error index.

    You can try asking the type of the variable $lun

    $luns = $VMHost|get-scsilun -luntype disk|
    where-object {$_.ConsoleDeviceName -like "/vmfs/devices/disks/vml*"} |
    where-object {$_.CanonicalName -like "vmhba0:0:*"}|Sort-Object CanonicalName
    
    ($lun.gettype()).Name
    
    $firstLUNPaths = Get-ScsiLunPath $lun[0]
    $numPaths = $firstLUNPaths.Length
    

    He will say 'object []' when it's a table, but "ScsiLunImpl" when it comes to a single object.

    An easy way to fix this would be to make a table even when there is only 1 object

    $luns = @($VMHost|get-scsilun -luntype disk|
    where-object {$_.ConsoleDeviceName -like "/vmfs/devices/disks/vml*"} |
    where-object {$_.CanonicalName -like "vmhba0:0:*"}|Sort-Object CanonicalName)
    $firstLUNPaths = Get-ScsiLunPath $lun[0]
    $numPaths = $firstLUNPaths.Length
    
  • How in the world someone meets a queastion or add info to a previous question? Where can I ask a simple question or add info to a previous quest

    Just as I suspected, I'm a bunch of predetermined responses. Where can I put the power to Mozzila a question about my particular problem? Do not give a lot of your presumptuous answers.

    DND has documentation, but the "Developer toolbar" is built into Firefox.

    You can try one of the following methods to remove the view:

    • Click on the small x at the right end to shut up
    • SHIFT + F2
    • button '3-bar' menu > developer > (uncheck) Developer Toolbar
    • (menu bar) Tools menu > Web Developer > (uncheck) Developer Toolbar
  • Question of WHERE Clause.

    All, I was just doing some checking at random and came across the following query

    SELECT * FROM emp WHERE +empno > 0;
    

    My question is that oracle runs the query above without any error. What is the use of such expressions in where clause and why the compiler does not throw error for these?

    I've never met such scenario. Just tried your query and it works. The reason is below.

    Look at what makes this request.

    SELECT - empno FROM emp;

    OUTPUT:

    -EMPNO
    ----------
    -7369
    -7499
    -7521
    -7566
    -7654
    -7698
    -7782
    -7788
    -7839
    -7844
    -7876

    -EMPNO
    ----------
    -7900
    -7902
    -7934

    14 selected lines.

    So you might see if you add a minus sign before the name of the column, it converts only for negative values.

    So, even if you add a sign "+", since these are positive values (> 0), your condition succeeds and gives the result. See what would happen if you used - empno in which your condition.

    SQL > SELECT * FROM emp WHERE empno - > 0;

    OUTPUT:

    no selected line

    Hope you clear how it works.

  • A very basic newbie question, sorry: where is the documentation for the presets?

    Hello

    I am writing some ExtendScript to do some tasks fairly banal export and, so far, it makes a lot of sense... but...

    I keep on having spend loads of time googling for names of constant classes with the relevant presets.

    Y at - it a correct, indexed and searchable reference of InDesign scripting library, somewhere? PLEASE, I BEG YOU!

    Thank you

    G

    Where everyone was as frustrated by what I was, and I know that this exposes my ignorance but...

    1. in ExtendScript, F1 to open help.

    2. Select the product you are developing against in the help panel.

    3. Google what you want to do and, if you're lucky, you will find an object type or method name for try the search against

    (4 use the search help and I hope to whatever you hold dear that has you) corresponds to something useful and b) do not match too (both cases will cause absolutely no useful data)

    This will give you some (but very basic) syntax searchable guides... Buyer beware...

    Syntax guides do not, for example, distinguish (or provide details of) the difference between the IDS server or Office IDS and method signatures are different...

    Incomplete, awkward and a little difficult to use, but at least it is the documentation...

    G

  • question of shared objects...

    I create a kiosk with room for comments from visitors.  There are several sections to the kiosk each with their own standalone .swf file (not browser based; no html).  I plan on the use of shared objects to collect the entrance of visitors in each section and these will be periodically reviewed by the staff of the Museum before actually posting.  My question is, can I create a .swf to the staff of the Museum that uses a table to examine each of the SO created by the different sections or will a flash read ONLY in a SharedObject file, forcing me to create a separate application for each section for the staff of the Museum?

    Thank you!

    It depends on how you define your so if they are defined with the more permissive setting ("/"), you can use a swf to load all the so

  • Question about the object

    public class Testing{
    public void status(Object d){
    System.out.println("object is called " + d);
    }
    
    public  void status(String s){
    System.out.println("String is called " + s);
    }
    
    public static void main(String[] args){
    Testing a = new Testing();
    a.status(null);
    }
    }
    Output : String is called null

    No doubt: I can't understand how including compiler to call status method with the String argument and not the one with the Object.Even argument if he did then why NullPointerException was not thrown during execution, since printing System.out.println ("the string is called" + s), it will call the method toString() on s and since it is null it should throw a NullPointerException.

    Any clarification on this is much appreciated.

    isocdev_mb wrote:
    I'm not clear on the method resolution (perhaps something on the more specific signature)

    NULL is considered as to be more precise in the hierarchy, so if you have overloaded methods where first one takes object, the second takes Foo (a subclass of object) and third takes the Bar (subclass of Foo), then one with the setting Bar would be called.

    But if you have a parameter Object and two methods with the subclasses of object as parameters, you will get a compilation error because specific to one can not be chosen.

    does not imply an invocation of toString(). s is a string already

    Nothing implies a call toString(). The method that is called is String.valueOf (param Object), which returns "null" when given null. No NPE, no problem.

  • so many Questions, but where are the apps?

    I see so many Questions, but I don't see a lot of flash apps

    where are they?

    you don't really know if they were not on the store or flash applications, it does not say. There is much, much up there, unless someone connects you directly you know until you started to play with it if it was an air application, sometimes you can tell when playing, sometimes does not

  • question of privilege object

    Hi, the oracle documentation says:

    A user automatically has all the privileges object for the schema contained in its own schema objects. A user can grant a privilege object on any schema object, that he or she belongs to another user or role. A user with the GRANT ANY OBJECT privilege can grant or revoke privileges specified object to another user with or without the GRANT option of the GRANT statement. Otherwise, the recipient can use the privilege, but may be granted to other users.

    For example, suppose that the user SCOTT has a table named t2:
    SQL>GRANT grant any object privilege TO U1; 
    SQL> connect u1/u1 
    Connected. 
    SQL> GRANT select on scott.t2 \TO U2; 
    SQL> SELECT GRANTEE, OWNER, GRANTOR, PRIVILEGE, GRANTABLE FROM DBA_TAB_PRIVS 
     WHERE TABLE_NAME = 'employees'; 
    
    GRANTEE                        OWNER                                GRANTOR                        PRIVILEGE                            GRA 
    ------------------------------ ------------------------------ ------------------------------ ----------------------------------------  --- 
    U2                             SCOTT                              SCOTT                          SELECT                                NO
    Now this confuses me. Surely it's U1, who is the grantor and not Scott, no?

    Oracleguy,

    I don't have you your point, but I guess that right reason if only that although the U1 user has not had the privilege and he could grant only because of the Grant Any Object private, it is not represented as the grantor, but Scott doesn't!

    [oracle@edhdr1p0-prod sqlplus]$ sqlplus / as sysdba
    
    SQL*Plus: Release 11.2.0.1.0 Production on Thu Feb 18 09:19:39 2010
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> create user u1 identified by u1;
    
    User created.
    
    SQL> grant create session, create table to u1;
    
    Grant succeeded.
    
    SQL> conn u1/u1
    Connected.
    SQL> select * from tab;
    
    no rows selected
    
    SQL> conn scott/tiger
    Connected.
    SQL> create table t2( a number);
    
    Table created.
    
    SQL> conn  / as sysdba
    Connected.
    SQL> grant grant any object privilege to u1;
    
    Grant succeeded.
    
    SQL> conn u1/u1
    Connected.
    
    SQL> select * from scott.t2
      2  ;
    select * from scott.t2
                        *
    ERROR at line 1:
    ORA-01031: insufficient privileges
    
    SQL> grant select on scott.t2 to system;
    
    Grant succeeded.
    
    SQL> conn / as sysdba
    Connected.
    
    SQL>  SELECT GRANTEE, OWNER, GRANTOR, PRIVILEGE, GRANTABLE FROM DBA_TAB_PRIVS
     WHERE TABLE_NAME = 'T2';
     WHERE TABLE_N 'T2'
                   *
    ERROR at line 2:
    ORA-00920: invalid relational operator
    
    SQL> SELECT GRANTEE, OWNER, GRANTOR, PRIVILEGE, GRANTABLE FROM DBA_TAB_PRIVS
      2  where table_name='T2';
    
    GRANTEE                        OWNER
    ------------------------------ ------------------------------
    GRANTOR                        PRIVILEGE                                GRA
    ------------------------------ ---------------------------------------- ---
    SYSTEM                         SCOTT
    SCOTT                          SELECT                                   NO
    
    SQL> 
    

    Now, when I explicitly give the priv to U1 and it gives him, he is shown as the beneficiary

    Sorry, I did not know that its still only Scott who is shown in both places.

    USER is "SYS"
    SQL> grant select on scott.t2 to U1;
    
    Grant succeeded.
    
    SQL> conn u1/u1
    Connected.
    SQL> grant select on scott.t2 to system;
    
    Grant succeeded.
    
    SQL> conn / as sysdba
    Connected.
    SQL> SELECT GRANTEE, OWNER, GRANTOR, PRIVILEGE, GRANTABLE FROM DBA_TAB_PRIVS
     WHERE TABLE_NAME = 'T2';   2  
    
    GRANTEE                        OWNER
    ------------------------------ ------------------------------
    GRANTOR                        PRIVILEGE                                GRA
    ------------------------------ ---------------------------------------- ---
    SYSTEM                         SCOTT
    SCOTT                          SELECT                                   NO
    
    U1                             SCOTT
    SCOTT                          SELECT                                   NO
    
    SQL> 
    

    Update:

    Oracleguy,
    That's what I found on this priv to docs,
    http://download.Oracle.com/docs/CD/E11882_01/server.112/e10592/statements_9013.htm#i2077938

    GRANT ANY OBJECT PRIVILEGE
         Grant any object privilege that the object owner is permitted to grant.
    

    So I guess it must explain what is shown in the view. Given that the owner is Scott who is authorized to grant the privilege, the name which is given here since its his privilege that is passed to the second user. -What looks like a reasonable explanation?
    HTH
    Aman...

    Published by: Aman... on February 18, 2010 09:36

    Published by: update added Aman... February 18, 2010 11:55

  • Question about l ' object net.rim.device.api.ui.Screen

    Hello world

    I have a class that accepts an object of type "Screen" (net.rim.device.api.ui.Screen) in its constructor. When I instantiate this class, I include a class that extends the screen as a parameter. For example:

    public ClassA extends MainScreen {
         public void tester(){
              ClassB classB = new ClassB(this);
         }
              public void sampleMethod(){        ...     }}
    
    public ClassB {
    
         Screen screen;
    
         public ClassB(Screen screen) {
              this.screen = screen;
         }
         public doStuff(){          screen.sampleMethod();     }}
    

    My problem is that ClassB calls methods that are placed, but unless I change type "Screen" in the "class A", I receive the error: "the sampleMethod() method is not defined for the type of screen.

    How can I me ClassB to accept different classes that extend screen?

    Thank you!

    "each screen implements a SampleMethod() interface.

    Then could ClassB looks like this?

    public ClassB {}

    SampleMethodInterface screen;

    public ClassB (form SampleMethodInterface) {}
    This.screen = screen;
    }

    public doStuff() {}
    screen.sampleMethod ();
    }
    }

Maybe you are looking for

  • HP Pavilion G6-2226TU: Remove Onedrive

    Recently I upgraded to Windows 10 of Windows 7 and there are some pre-installed apps which I am not like especially the Onedrive I have another account of cloud on another Cloud Computing service and I also installed that but the Onedrive is by defau

  • MacBook Air Flash storage problem

    So I just got a Macbook air mid 2012. It has 128 GB flash storage whilst running the latest Mac OS X Version 10.11.1 and the problem is that it is either showing wrong info or a lot of storage was taken over by something unknown. Apps took more than

  • Photo album - how we change our country for delivery

    I want to have a photo album that is delivered to a country different than on my account. How can I do to change this. I go as far as your billing/delivery change address but then it just allows me to change the country.   Thank you

  • 3280 RTC battery

    What type of battery RTC a Travelmate 3282 require?  I found two coin batteries 2032 1220 NS shown when searching on the web.  The reference number of the repair doesn't help much.  Thank you Steve

  • Imminent disk failure toshiba mk6465gsx ata device - utility?

    My laptop DV6 gives sudden message that there is an imminent disk failure.    Recently saved.  Reading on a support page that could be a problem with the CHIP.    Article says to download the Seagate utility, but it is a Toshiba drive I have. I don't