Get-view SearchRoot when duplicate. MoRef exists

I created a script to list the details of the bunch and I thought I would faster by using get - view instead of the Get command for each object.  I came across a problem on line 14.  It seems that I have data centers in different virtual centers with the same. MoRef values.  Not sure how I can script around that.

Note that this script below is a global script version

$csvreport = @()
$ClusterList=@()
$OutputFile="C:\Temp\looptesting.csv"
$Date=Get-Date -Format d




  foreach ($virtualcenter in $DefaultVIServers) {


  ForEach ($DC in (Get-View -ViewType  Datacenter -Server $virtualcenter)){

  Foreach ($cluster in (Get-View -ViewType ClusterComputeResource -SearchRoot $DC.MoRef)){

  $ClusterList = "" |select-object "Collection Date","Virtual Center",DataCenter,Cluster

  $ClusterList."Collection Date"=$Date
  $ClusterList."Virtual Center"=$virtualcenter
  $ClusterList.DataCenter=$DC.Name
  $ClusterList.Cluster=$cluster.Name

  $csvreport += $ClusterList 
  }
  }
  }




$csvreport |export-csv -NoTypeinformation $OutputFile

Can't you just use the Server parameter on line 14, as you did on line 12?

Tags: VMware

Similar Questions

  • When I turn on my computer, I get this message, "a duplicate name exists on the network."

    I've had this name for years, what happened?

    Thanks for the reply.  No, the computer name and workgroup name are not the same.  Should they be?

    No, if they were the same, which can cause the error you see.

    I can't guess any further, unless you answer the other questions.

    The error is a complaint that another device on any network to which your computer is connected has the same name as the 'full name' shown in system properties.

    Although there are utilities that scan your network and to report the names of connected devices, they are somewhat nonsimple to use and probably would not work on a computer that will expose the error your report.

    If your computer is on a home network, share an Internet connection using a router, you can manually check all other devices.  You don't maybe not easily able to determine the 'computer name' no computer network devices, but it is highly unlikely that such a device, for example, a network printer, called "Lamb stew Computer" or else you might have named your computer.

    Just to be sure there isn't something special going, disconnect your computer from your network (or your Internet connection) and then it reboot.  The duplicate name error should NOT appear if the computer is not connected to a network.

  • MoRef filtered get - view

    Try to get resutlts an error

    PS > Get-View - ViewType property, Parent, MoRef hostsystem-name

    Get - view: 2011-02-08 08:46:35 Get-View

    Online: 1 character: 14

    + Get-view < < < < ViewType - hostsystem-name of the property, Parent, MoRef

    + CategoryInfo: NotSpecified: (:)) [Get-view], InvalidProperty)

    + FullyQualifiedErrorId: Client20_MoServiceImpl_GetNetInteropEntityView_ViError, VMware.VimAutomation.ViCore.Cmd

    ts.Commands.DotNetInterop.GetVIView

    I can still run and access.

    PS > (Get-View - ViewType hostsystem). MoRef

    Is there a way to specify this property which must be returned?

    Kind regards

    Ryan

    The command

    Get-view ViewType - hostsystem-name of the Parent property

    Returns an array if you have more than one host. This means that you must do something like:

    (Get-view ViewType - hostsystem-name of the Parent property) [0]. MoRef

    or

    $x = get - View - ViewType hostsystem-property name, Parent
    $x [0]. MoRef

    to retrieve the first host MoRef.

  • My gmail and Icloud accounts disappear from the list under "Mailbox store" in the mail. When I try to recreate my gmail account using the "new mailbox...» "I get the message"this account already exists. " What can I do to recover my mailboxes.

    I use YOSEMITE 10.10.5.

    My gmail and Icloud mailboxes (and several smart mailboxes) disappear from the list under "Mailbox store" in the mail. When I try to recreate my gmail account using the "new mailbox...» "(using the sign on the side down and to the left of the screen in Mail +) I get the message"this mailbox already exists. ». What can I do to recover my mailbox?

    Restart the Mac and Mail.

  • I stopped to receive mail after December 31.  It indicates that the computer cannot connect to my account but when I log in with my password I get the message "this account already exists." How can I get my email account to work again?

    I stopped to receive mail after December 31.  It indicates that the computer cannot connect to my account but when I log in with my password I get the message "this account already exists." How can I get my email account to work again?

    MacBook Air, OS X El Capitan

    First of all, make sure that you don't have two accounts with the same address. What happens if one of them is an iCloud account.

    From the Mail menu bar, you select

    ▹ Connection Doctor window

    In the window that opens, look for an SMTP (outgoing mail) account with a name that corresponds to the account that you are trying to add. Double-click it. Another window opens, displaying the list of all outgoing mail accounts. Click the sign button less to remove the corresponding one, and then click OK.

    Try to add the email account again. If you still can not, log off or restart the computer, and then open the preferences window accounts Internet and check if the account is displayed.

  • When I turn on my computer, when I log in, the computer tell me that a duplicate name exists,

    When I turn on my computer, on the start page of the sign, the computer tells me in one or two boxes that a duplicate name exists on the computer. Sometimes, when I'm working on the computer on the bottom right a yellow shield stands up and says that a duplicate name exists. When I click on it. He just disappears. I don't know how to solve this problem. my computer started running real slow at the start of this problem. I don't know not one of my kids did something, but they claim that they have not, please help me solve this problem

    Although you probably solved this problem, the simple solution would be to rename you the computer.

    http://www.Microsoft.com/resources/documentation/Windows/XP/all/proddocs/en-us/sysdm_ident_change_computer_name.mspx?mfr=true

  • I get a message when I am importing (this seems to be a duplicate of another picture already in the catalog) pic is grayed out.

    I get a message when I am importing (this seems to be a duplicate of another picture already in the catalog) pic is grayed out.

    From the library module, look for the image with the same filename and see where LR think there already.

  • I downloaded the free app Adobe Content Viewer, but when I try to connect, I get an error message "authentication failure". What should I do to fix?

    I downloaded the free app Adobe Content Viewer, but when I try to connect, I get an error message "authentication failure". What should I do to fix this?

    Did you go digitalpublishing.acrobat.com, connect with the Adobe ID and accept the terms of use? If this is not the case, do using a computer. You can't do this from a mobile device. This is not an automatic process, you must do it manually.

  • duplicate name exists on the network: can spy on me

    I get this error message on an existing when duplicate name that I start.
    I read the patches for this, but what I'm wondering is...
    Assuming that the name "duplicate" is another computer, we are related in any way other than
    by name and network? I want to know if Name2 (the other) is aware of name1 (me) regarding
    like keystrokes, passwords, navigation, etc. ? What is the possibility exists for a name
    'spy' on the other? -I'm on a wireless home network.
    Because the error messages began, an oddity came with them... many times I have to
    Click a button a second time, then wait for 1-2 seconds, whereas before, a simple left click
    has brought an immediate response. Are us bogged down each other?

    Let us know if the issue of the double name reappears; It should not.

    I suspect that your mouse is having mechanical problems. Are you using the left button of the mouse much (for example, in games)?  Or there may be a foreign substance (dirt) in the switch.

    If you have another mouse, you can try for a while to see if the problem persists with another mouse.  You can also go in Control Panel > mouse and (temporarily) the right switch and buttons to the left of the mouse - but this is not something you want to probably keep for any significant amount of time and if the problem occurs only intermittently, you may not be able to definitively determine that it does not occur when you use the right button to the usual left button functions.

  • Get-View for VMS in subfolders

    Hello community

    I need the list of all the virtual machines in a specific folder, including subfolders.

    In fact, I use the following script

    $vms = Get-Folder "VDI" | Get-VM | Where-Object {$_.PowerState -eq "PoweredOff"}
    
    foreach($line in ($vms | Get-Random -Count 20) ) { 
        if($line.PowerState -eq "PoweredOff") {
            $line | Start-VM -RunAsync | Out-Null
        }
    }
    

    The script runs periodically, and it will take more than 30 seconds to over 2000 virtual machines I want to speed up with Get - view. I've already tried it, but unfortunately it does not list the virtual machines of the subfolders.

    Someone at - it an idea how to solve this problem?

    You can try like this

    $folderName = "VDI".

    $folder = get-View - ViewType property file-name - filter @{'Name' = $folderName} | Select MoRef - ExpandProperty

    Notice-EEG - ViewType VirtualMachine - SearchRoot $folder |

    Select name

  • Using filters and Get - view to find virtual machines with a specific guest operating system.

    I have the following code snippet to find all virtual machines with the updated OS to ' Red Hat Enterprise Linux * "prompt. It does not work. If the filter is left out, I find myself with all virtual machines.

    The immediate question is the specs for the game ' Red Hat Enterprise Linux. " Originally from the "Performance Difference between GET - VM and GET-VIEW")

    http://www.batchworks.de/performance-difference-between-get-VM-and-get-view/ ).

    $ClusterFilter = Get-View -ViewType ClusterComputeResource -Property Name -Filter @{“Name” = $ClusterName } | select -ExpandProperty MoRef

    $VirtualMachines = Get-View -ViewType VirtualMachine -Property Config -SearchRoot $ClusterFilter


    The biggest problem for me is to understand for Get-View filter. I was capable of a bit of insight to gleen from the URL below, but I think what Miss me is the reference (Microsoft) for what is happening to the right of the equal sign. What is the correct terminology for this type of query expression / where the syntax is 'left' = 'straight' and keywords such as "-match" are not allowed.

    http://purple-screen.com/?Cat=3

    VMware vSphere 5.1

    http://Wannemacher.us/?p=259

    Regular expressions with Windows PowerShell

    Right in the filter expression is an RegEx expression, please allow for characters before and after the word Linux.

    And the name of the OS is Config.GuestFullName.

    I corrected the entries more early as well.

    $ClusterName = "^MyCluster$"$ClusterFilter = get-view -ViewType ClusterComputeResource -Property Name -Filter @{"Name" = $ClusterName } | select -ExpandProperty MoRefWrite-Host $ClusterFilter
    
    $VirtualMachinesNoFilter   = Get-View -ViewType VirtualMachine -Property Name,Config -SearchRoot $ClusterFilter $VirtualMachinesWithFilter = Get-View -ViewType VirtualMachine -Property Name,Config -SearchRoot $ClusterFilter -Filter @{"Config.GuestFullName"=".*Linux.*"}
    
  • A duplicate name exists on the network

    Hello

    We are trying to install a 4.6 view environment and am getting an error on my VMs that a duplicate name exists on the network. The pool does not composer and is automated with assignment of the user of floating. I created a template which is Windows XP and on our field. Research on virtual machines that there where to create the pool, they each kept the model name VM's DNS name is following my pattern of naming. Is it possible to have virtual machine created by the pool GET a new name?

    Thank you

    You must use sysprep/quickprep to rename the guest operating system: http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=2003797

    I think that you can only use quickprep with linked clones, so you need to use sysprep:

    1. download Microsoft sysprep (http://support.microsoft.com/kb/838080)

    2. you will need to prepare your sysprep answer file (it is a good guide: http://capitalhead.com/articles/force-sysprep-to-prompt-for-a-computer-name-during-mini-setup-in-windows-xp.aspx)

    3. If you are using the guide above and you let the ComputerName = * in place, it will automatically generate a new name for the computer for you.  If you remove the * you will need to enter a computer name whenever a new virtual machine is created.  Not exactly ideal because it is supposed to be automatic, but at least you would get a control.

    4. install the deployment tools XP on your server vCenter (C:\Documents and Settings\All Users\Application Data\VMware\VMware VirtualCenter\sysprep\xp)

    5 load your Sysprep.inf in your 'customization specifications' within the VI client.

    This gives you a name generated randomly for each virtual computer.  Unfortunately, I have not been able to find a way to make this name match the pattern specified in the pool.  I gave up at the end and switched to linked Clones as it makes the whole process a million times easier

    Hope this helps

  • All of a sudden get error 646 when my computer tries to automatically install security updates.

    I'm getting error 646 when it's time for my computer automatically install updates on Microsoft Office Visio Viewer 2007 (KB973709 and 8 (KB973636) Microsoft works, so on, System (KB972581) 2007MicrosoftOfffice and a supplement 2007Microsoft Office System (KB974234))

    Hello

    Try this 1st to see if it helps, and it should:

    Description of the Patch registration cleanup tool
    http://support.Microsoft.com/kb/976220/

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

    If necessary :

    Try this - Panel - Windows Updates - on every update that will not be installed - click on the important updates
    or the update itself - double click a view more information (or click top then discovers on the right)

    Those who will take you to a page where you can download the update.

    Or go here and the KBxxxxxx number to download it.

    Download Center - mount the KBxxxxxx.

    Microsoft Download Center
    http://www.Microsoft.com/downloads/en/default.aspx

    Download - SAVE - go to where you put them - click on - RUN AS ADMIN

    Then you can right click on the update in the updates Windows and HIDE.

    If you get an error Installer install this version:

    Windows install 4.5 Redistributable
    http://www.Microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en

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

    Then run this:

    How to reset the Windows Update components? -a Mr Fixit
    http://support.Microsoft.com/kb/971058

    Description of the system for Windows Vista, Windows Server 2008, update tool and
    for Windows 7
    http://support.Microsoft.com/kb/947821

    ------------------------------------------------------------
    Because these are all Office updates you might get more information if necessary in the Agency of those groups that
    may have experienced the same problem.

    Office newsgroups
    http://www.Microsoft.com/Office/Community/en-us/FlyoutOverview.mspx

    Microsoft.public.office.misc discussions
    http://www.Microsoft.com/communities/newsgroups/list/en-us/default.aspx?DG=Microsoft.public.Office.misc&cat=en_us_01cb749f-c998-4762-8099-df71793c11c7&lang=en&CR=us

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

    If necessary you can incident free get reports however the above should take care of it for you.

    Windows updates - free Incident report

    Go here and click on-> Windows Update fails while searching, downloading or installation of updates
    http://support.Microsoft.com/GP/wusupport#tab3

    The security updates, you can get free support Incident report
    http://www.Microsoft.com/protect/resources/support.aspx

    I hope this helps.
    Rob - bicycle - Mark Twain said it is good.

  • I can't use windows update. I get an error when I try to use it.

    I can't use windows update. I get an error when I try to use it. Someone knows how to solve this problem

    Original title: I have a desktop pc with windows xp, I can't use windows update. An error when I try to use it. Someone has any idea how to solve this problem.

    You must be at Service Pack 3 level before you can use Windows updates.

    To determine which service pack is currently installed on your computer, follow these steps:

    1. Click Startand then click run.
    2. Copy and paste, or type the following command, and then click OK:

    winver

    A dialog box displays the version of Windows and the service pack that is currently installed on your computer.

    If you haven't already done so, you will need to install the SP2 and SP3 (SP1 note no longer exists).

    How to obtain the latest Windows XP service pack

    http://support.Microsoft.com/kb/322389

    SP2 - http://www.microsoft.com/en-us/download/details.aspx?id=28 (for single PCs too)

    For Windows XP Service Pack 2 installation procedure

    http://support.Microsoft.com/kb/875364

    Steps to take before you install Windows XP Service Pack 3 http://support.microsoft.com/kb/950717

    It is stated in "How to obtain the latest service pack XP" is.

    If you have problems obtaining the service pack from Windows Update, you can download the package of standalone update from the Download Center. This page will say that this installation package is intended for it professionals and developers. However, you can download this file safely. The following file is available for download from the Microsoft Download Center:

    See also: http://support.microsoft.com/kb/2497281

    April 8, 2014, support and updates for Windows XP will be more available. Don't let not your PC not protected.

    http://Windows.Microsoft.com/en-AU/Windows/end-support-help

  • I get more kod when try to uppdate windows: 0x13EC

    Hello

    I get more kod when try to uppdate windows: 0x13EC. The uppdate name is Microsoft .NET Framework 3.0: Sprakpaket for x 86 (KB928416).

    Sincerely

    ARIO Nahram

    Hello

    1. don't you make changes on the computer before the show?

    2 are you able to install some other updates?

    I suggest you try the steps mentioned below and check if it helps.

    Method 1: Fix the term.

    The problem with Microsoft Windows Update is not working:
    http://support.Microsoft.com/mats/windows_update/

    Method 2: If the problem is still not resolved, you can try to reset the Windows Update components.


    How to reset the Windows Update components?

    http://support.Microsoft.com/kb/971058

    Warning: Important This section, method, or task contains steps that tell you how to modify the registry. However, serious problems can occur if you modify the registry incorrectly. Therefore, make sure that you proceed with caution. For added protection, back up the registry before you edit it. Then you can restore the registry if a problem occurs. For more information about how to back up and restore the registry, click on the number below to view the article in the Microsoft Knowledge Base:

    322756 (http://support.microsoft.com/kb/322756/)

    How to back up and restore the registry in Windows

    Hope this information is useful.

Maybe you are looking for

  • Spare part Portege M930 digitizer pen

    Hello I'm having a little difficulty finding replacement/pens digitizer replacement for my Portege M930 - I still have the pen that comes with it, but I've been known to lose this kind of thing, so I want to be ready for the inevitable and know where

  • Pavilion DM4-2070us uninstalled touchpad but still active, Windows 7 64 bit

    I prefer the touchpad mouse so I uninstalled and connected a wireless mouse. However, the keyboard remains active, and of course I can not turn off with double button in the off position. This results in an involuntary movement of the cursor when the

  • Hibernate does not work under vista

    My PC won't come back into hibernation automatically. Can someone tell me how to set power options to please?  Thank you

  • Hide the E20 home menu by default

    Hello Is it possible to hide the default home on an E20 menu? I can press the home button and the start menu is hidden again, but after each call, I need to do this. It now covers my personal happy wallpaper that is not a big problem, but it would be

  • Is it possible to silence dreamweaver?

    Whenever I need to move from one page to another that I'm prompted to save the page before I leave with this increasingly more annoying "BONG!" Message "do you want to save the {page} before exiting?"."Can I delete this prompt save?  "If I can decide