getting name from vCenter for VM

Hello

Is there a way to get the name of the vCenter virtual machine is managed by, if I start with the VM name?

I have 2 vCenters joined in related modes and connect both at the same time when I run scripts. I would like to add a field in my outings such as VMname, vCenter, VMhost, etc.

I had an idea to follow the parent files; but seem to stop at the data center.

Thank you.

You can retrieve the name of the property of the virtual computer object vCenter server. Like this:

(Get-VM YourVMName).Uid.Split(":")[0].Split("@")[1]

PowerCLI 4.1, you can extend the virtual computer object with a vCenterServer property. Like this:

New-VIProperty -Name vCenterServer -ObjectType VirtualMachine -Value {$Args[0].Uid.Split(":")[0].Split("@")[1]}
Get-vm YourVMName | Select-Object -Property Name,vCenterServer

Best regards, Robert

Tags: VMware

Similar Questions

  • Need to change the name from vCenter through code

    Hi all

    I can't understand this, I hope that this is a real simple thing to do. I need to change the name of the vCenter, like what's in the screenshots below, but using the powershell code

    http://communities.vmware.com/servlet/JiveServlet/downloadImage/8596/vcenternamechange.JPG

    can someone show me how it's done?

    See you soon!

    Depending on whether you have vCenter, Update Manager, and licenses executed on the same host server, it is not a simple operation.

    See for example KB1006843.

    To emulate the rename also can be done by vSphere Client is simple.

    You must be connected to the vCenter.

    $optMgr = Get-View (Get-View ServiceInstance).Content.Setting
    $optVal = New-Object VMware.Vim.OptionValue
    $optVal.Key = "VirtualCenter.InstanceName"
    $optVal.Value = 
    $optMgr.UpdateOptions($optVal)
    

    ____________

    Blog: LucD notes

    Twitter: lucd22

  • How to get the moref vCenter for a virtual machine

    I use with the vCloud orchestrator plugin.  I would like to understand how I can access the moref for a virtual machine identifier (as see vcenter) that is contained in a vCloud VAPP.

    Thank you

    Here is something I wrote to do. It uses the query service.

    Note that to be able to do, you need your plugin vCD to be connected to the org of system and use the administrator credentials.

    var vcdHost = vm.getHost();
    var vApp = vm.parent;
    
    var vms = new Array();
    var queryService = vcdHost.getQueryService();
    
    expression = new VclExpression(VclQueryAdminVMField.CONTAINER, vApp.getReference().href, VclExpressionType.EQUALS);
    filter = new VclFilter(expression);
    params = new VclQueryParams();
    params.setFilter(filter);
    
    var resultSet = queryService.queryRecords(VclQueryRecordType.ADMINVM, params);
    while (resultSet != null) {
        var records = resultSet.getRecords(new VclQueryResultAdminVMRecord());
        System.log(records.length + " VM records found");
        for each (var record in records) {
            if (record.name == vm.name) {
                return record.moref;
                }
    
        }
        resultSet = resultSet.getNextPage();
    }
    return null;
    

    Christophe.

  • The upgrade from vCenter for 64-bit

    I'm about to upgrade from version 4 to version 4.1 vcenter server and I have a few quick questions. I am a little concerned about the part of the database from the upgrade.  We currently have the database on a server remote windows 2003 and I was curious what, if anything, I have to do to the database if I use the DataMigration tool?  I have a new 64 bit server ready to go, but I'm a little curious what needs to be done to the database and it is ok to point the new 64-bit to 32-bit SQL server vCenter?  any help is appreciated.  Thanks for a great site!

    Perry

    prutter wrote:

    Yes, it is remote.   I have it!  Is the same thing applies to the Bishop of update database?  Thanks again.

    Yes, but Crossover requires a 32-bit DSN

  • How to get assistance from Mozilla for Firefox with captcha does not?

    How the hell can I get any kind of support for Mozilla Firefox that is not some 3rd party site which tells me things are screwed up and it will cost money to repair! My solution is to can firefox but I always liked, but since captcha does not seem to work on Firefox 32, the firefox browser has become useless!

    If you use extensions (Firefox/tools > Modules > Extensions) which can block content (e.g., Adblock Plus, NoScript, Flash Block, Ghostery) then make sure that these extensions are not blocking content.

    Note that run you Firefox in permanent private browsing mode (don't remember history).

    This also happens in normal mode?

  • I want to get email from icloud for my daughter on my pc

    Hello.  I am a user of windows 7 that is running Outlook 2016 and icloud for windows for sharing photos.

    I want to get copies of all emails sent to my son and my daughter.  (9 and 12).  Is there a way to do this?  If not with Outlook with other programs...

    Thank you

    Chris

    You can not do this without them know - they can choose to do this cut at any time

    Sign up their account to www.icloud.com

    Click on Mail

    -Click on the gear icon settings - bottom left then Preferences

    Under general - middle of the page is - Forwarding

    Automatically track the email enter your email address where you wish to receive

    As I mentioned - your child can go and uncheck or remove the e-mail recipient is dependent on their cooperation

    It's the only way I know

    (1203)

  • Getting data from DB for each page load

    Hello

    I use JDevloper 11.1.1.4. I have display objects in the child-parent relationship of level three.

    For example viewobject1 (grandparent), viewobject2 (parent), viewobject3 (child). I want the amount of a particular attribute in viewobject3 be changed dynamically based on the exploitation of the page in which viewobject3 is linked. Suppose that the page contains a table. This table has a column 'paying '. I want that the total of the column "compensation". I added in the bottom of the column in the table. When deleting a row in a table the total should be amended accordingly.

    I believe that groovy is preferable to use in this case. That's why I tried both approaches.
    (1) we must, an attribute viewobject3 as transitional and use groovy (sum ("pay")); in its value field. This generates an error "name not found in the given object sum: ViewRow [oracle.jbo.Key [492339-7597]].»
    (2) the other is to, have a transitional attribute in viewobject2 and the calculation of the sum expressed in groovy (view3.sum ("pay")). But this results in the page quite rarely. In other words, when you load for the first time, it shows correctly. After deleting a record, he makes sometimes total and sometimes not.

    These two approaches does not seem to work.

    Could someone tell me if I am following an appropriate approach

    Kind regards
    V. Praveen

    Published by: Praveen Sep 26, 2011 16:45

    Could you pls try this

    object.getRowSet (.sum ('Pay'))

  • Get data from YEAR_WEEK for the next WEEKS 20

    Hi all

    I have a select query and when I run this query, that query is display data for all YEAR_WEEK of PROD_BACKLOG table. The YEAR_WEEK column in the PROD_BACKLOG table data in this format 2030-WK41.

    My select query is the following
    SELECT 
                  DC_UTIL.GEN_YEAR_WEEK(MSD) YEAR_WEEK,
                  ITEM_NUMBER,
                  BACKLOG_QUANTITY,
                  MSD
                  to_char(MSD, 'IW')
                  FROM prod_BACKLOG
                  where to_char(MSD, 'IW')>to_char(sysdate, 'IW');
    I would like to add a clause in this query should it search only for data for the next few weeks more 20.

    Thanks in adavnce

    Concerning

    Hello

    I think that you have given for more than a year, which is why queries of does not return the same number of lines:
    -For your TO_CHAR, you keep only the week number and don't care of the week, which means that the 29th week of 2011 is the same as the 29th week of 2012
    -With the TRUNK, you compare the first days of the week, which include information on the year

    Here is an example: you'll see Date1 is the same for 2 dates, but Date2 shows different results and take care of the year:

    with t as (
    select to_date ('20/07/2011','DD/MM/YY') MSD from dual union all
    select to_date ('20/07/2012','DD/MM/YY') MSD  from dual
    ) select to_char(MSD, 'IW') date1, trunc (MSD, 'IW') date2 from t;
    
    DATE1      DATE2
    ---------- ---------
    29         18-JUL-11
    29         16-JUL-12
    

    You must choose the trunc.

    Using< or=""><= in="" this="" part="" of="" the="" where="">

    and trunc(MSD, 'IW')<=trunc(sysdate+140, 'IW');
    

    won't change of data greater than the week or not, but will include or not data for the 20th week.

    Hope that is more clear.

    Kind regards
    Sylvie

  • Getting name of swatch for character

    Hello

    I need to loop through each character in a block of text and check the color of each character.  Is it possible to get the name of the nuance of each character?  Or you can get red, green, blue values?

    I have been experimenting with:

    app.activeDocument.textFrames [0] .characters [3].characterAttributes.fillColor.typename;

    Returns SpotColor

    But I can't understand how to get the name of the nuance of the character in this way?

    Thank you.

    Jay

    spot colors have a property to get the name

    alert(app.activeDocument.textFrames[0].characters[3].characterAttributes.fillColor.spot.name);
    
  • Get links from dosbox for update in Games Explorer

    I placed links to dosbox game wrapped securities in the explored game and need to know how to force windows to load the data of boxart for them.

    Hi Jeffpiatt,

    Welcome to Microsoft Answers Forums.

    Games explorer is a Microsoft application that contains games that are supported by Microsoft. DOSBox games are third party games that are not supported by Microsoft so that you can not update or display in Games Explorer.

    Thanks and regards.

    Thahaseena M
    Microsoft Answers Support Engineer.
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • Identify a vCenter for VIM vCloud object instanceUuid

    Hello, I am trying to understand the best way to get the UUID vCenter for VIM vCloud object (in my case a resource pool, for which I have the MoRef) to identify the corresponding object of vCenter.   I want to use a given resource pool reference (Playback a pvDC) to find the purpose of grouping of real resources in vCenter, many vCenters recorded vCO/VCD since the MoRef is not unique between vCenters.  There is an article by William Lam (http://blogs.vmware.com/vsphere/2012/02/uniquely-identifying-virtual-machines-in-vsphere-and-vcloud-part-1-overview.html) that describes the relationships, but an example to solve this with vCO would be appreciated.

    The following should return the UUID of your vCenter Server Server assuming the input object is a vCloud:ProviderVdc object named 'providerVdc '.

    var vcdHost = providerVdc.getHost();
    var pool = providerVdc.toAdminExtensionObject().getResourcePools()[0]; // get the first resource pool (VclVMWProviderVdcResourcePool)
    var vimObjectRef = pool.resourcePoolVimObjectRef;
    var vimServer = vcdHost.getEntityByReference(VclFinderType.VIM_SERVER,vimObjectRef.vimServerRef);
    System.log("VimServer uuid: "+vimServer.uuid);
    
  • I unsubscribed from my application only one then it refunded, but how long does take to get to my accounan for me to get my money back

    I bought a computer application don't work well one I unsubscribed from my application one then it refunded, but how long does take to get to my accounan for me to get my money, I have looking for Bowen but I Don t have the refund back on my account

    < re-titled by host >

    Normally apple support sends you an email when a purchase is refunded. Most of the time it will hit your account within 72 hours.

  • iCal 'Get Info' is grey for the blue calendar; Other calendars are very good. Model name: iMac model identifier: iMac9, 1

    iCal 'Get Info' is grey for the blue calendar; The other color calendars are very good.

    I deleted the file 'com.apple.iCal.plist '... No luck.

    Please notify. Thank you, Roger



    Presentation of the material:

    Model name: iMac

    Model ID: iMac9, 1

    Processor name: Intel Core 2 Duo

    Processor speed: of 2.66 GHz

    Number of processors: 1

    Total number of cores: 2

    L2 Cache: 6 MB

    Memory: 4 GB

    Bus speed: 1.07 GHz

    Boot ROM version: IM91.008D.B08

    Version of the SCM (System): 1.44f0

    If the problem is still there, try to start safe mode using your usual account.  Disconnect all devices except those necessary for the test. Shut down the computer and then put it up after a 10 second wait. Immediately after hearing the startup chime, hold down the SHIFT key and continue to hold it until the gray Apple icon and a progress bar appear. Startup is considerably slower than normal. This will reset some caches, forces a check for directory and disables all start-up and connection, among other things. When you restart normally, the initial restart may be slower than normal. If the system is operating normally, there may be 3rd party applications that pose a problem. Try to delete/disable the third-party applications after a reboot using the UN-Installer. For each disable/remove, you need to restart if you do them all at once.

    Safe mode

  • How to get assistance from mozilla to answer questions for windows when I use a macintosh computer

    How to get assistance from mozilla to answer questions for windows when I use a macintosh computer?

    Look on the right side of the knowlegde base articles, where it is said ' help to ". Here, you can change the operating system and the version of firefox. The content of the article will adjust.

    If you ask a question on the help forum, you can simply say this in your question.

  • Get information from file name

    Hello

    I have a somewhat general question, is it possible to extract certain "elements" of a file name?

    For example: x 0 xx xxx abc 123 xxxx.avi (or any other type txt, jpg, etc...).

    Assuming that the 'abc' is constant throughout the files, but the numbers change (not sequential), can I retrieve just the "abc 123"(ou quelque nombre que ce soit)? "»

    I know how the band/build path, but here I don't know what to look for because the distance from the beginning is evolving and the numbers change.

    Thank you

    It has functions of research dedicated to the channels that you should study. It is a fundamental mission of LabVIEW.

Maybe you are looking for

  • What is tha giving version of Firefox compatile with MAC OS 10.4.11

    When I load the latest version of firefox supposidly compatible with my calculation I get a message, it is not compatible and should I dowm load the latest version tha it is compatible with my system, 10.4.11 running on a 5 G machine based. INTELL NO

  • HP officeject j4580: PLEASEE HELP. Printer connected to the laptop

    OK, so I have a destop computer hooked up to my hp officejet J4580 printer. I had my desktop computer for years and he's going so slow.  So I thought to hang my printer to my laptop Hp 15 to make things easier. However I don't really know how to do.

  • Restore files after restoring the image using Windows backup

    Running W7 pro 64-bit. Had the problems of virus/malware, finally restored my discs from image system, dated 2 weeks ago and then restore backup files dated Windows from yesterday. When I go to save / restore my files, the update does not list a back

  • Manager.Replace twice?

    Hi all. I am trying to replace a field of my screen and have already made: () fOriginalField.getManager replace (fOriginalField, fNewField); But now I can not do the opposite (I want to go back to its original state). I get a null pointer exception w

  • Mahjong does not open

    I hadn't played Microsoft Mahjong for weeks, now when I click on it, it seems open, but do not. I agreed in my Start menu as well as out of the menu thing same apps a huge icon appears on the screen then more nothing. It is also produced with Solitai