Help - automation of the ad groups in assigning roles for a virtual machine

Hi all, I have this doubt.

We are the migration of vSphere 4.1 and 5.1

Not by update manager, but manually adding hosts an accumulation 5.1!

Here's the thing, each virtual machine that will be imported/created/deployed to this new vCenter 5.1 will have a corresponding pre configuration of group by our admin guy!

For — for example, if the virtual computer name is vm_0123, a group called "SVR_VM_0123" would be ready and waiting to be assigned to this specific virtual machine, and then to a role. And this permission will be set at the virtual machine level.

And now, all the virtual machines that will be added to 4.1 and 5.1 have their configuration of groups!

So can automate us the "attribution" permissions on each computer virtual imported/created (a role common to the respective groups) through PowerCLI?

Questions or suggestions are welcome!

Thank you

I assume you have the virtual computer name in the variable $vmName, then you could do

$vm = get-VM-name $vmName

New-VIPermission-body $vm - main ("SVR_" + $vmName) - role $role

You can place these lines in a loop.

This could be for example a loop, controlled by the content of a CSV file.

Something like that

Import-Csv C:\vmnames.csv | %{

$vm = get - VM - name _.vmName $

New-VIPermission-body $vm - main ("SVR_" + $_.vmName)-role $_.role

}

This means that the CSV file should look like this

"vmName"; "" role.

"vm1', 'administrator '.

"vm2', 'read only '.

Tags: VMware

Similar Questions

  • Returns the value limit, CPU/RAM booking for all virtual machines

    How can I add a reservation of VMs and limit for CPU and RAM to it?  Thank you.

    {foreach ($vm in Get - VM)
    $guest = get-VMGuest - VM $vm
    $row = "" | Select VMName, TotalMemory TotalCPU,

    $row. VMName = $vm. Name
    $row. TotalMemory = $vm.memorymb
    $row. TotalCPU = $vm.numcpu
    }

    Use the Get-VMResourceConfiguration cmdlet.

  • CLI can be used to assign AD accounts to virtual machines

    Hi, I am interested in the possibility to use the CLI to assign accounts Active Directory for VMs. currently there are 10 virtual machines created from a template and there are 22:00. 1 AD account is assigned to each of the virtual machines. They are used for training purposes. Virtual machines are then removed and repeat the procedure. Is it possible that I can attribute the AD account name to a particular virtual machine using the command line?

    Thank you

    You can use the new-vipermission to assign permissions to a virtual machine.

    new-vipermission -entity (get-vm SQL04) -principal "Mishchenko\dave.mishchenko" -Role "Admin"
    

    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.

  • How to find the age of a child and snapshot number snapshot for a virtual machine.

    Hi all

    How to find the age of a snapshot for a virtual machine child count and snapshot.

    This code snippet should help... Assuming that you have the following entries:

    VM (VC:VirtualMachine)

    snapshot (VC:VirtualMachineSnapshot)

    System.log("====== Snapshot details for VM: "+snapshot.config.name+" ======");
    var snapshotTrees = vm.snapshot.rootSnapshotList;
    System.log("Snapshot Tree Count: "+snapshotTrees.length);
    for each (snapshotTree in snapshotTrees){
        showSnapshotInfo(snapshotTree, snapshot);
    }
    
    function showSnapshotInfo(snapshotTree, selectedSnapshot){
        if(selectedSnapshot == snapshotTree.snapshot){
            System.log("====================");
            System.log("Name: "+snapshotTree.name);
            System.log("Id: "+snapshotTree.id);
            System.log("Description: "+snapshotTree.description);
            System.log("createTime: "+snapshotTree.createTime);
            System.log("quiesced: "+snapshotTree.quiesced);
            System.log("replaySupported: "+snapshotTree.replaySupported);
            System.log("backupManifest: "+snapshotTree.backupManifest);
            System.log("snapshot id: "+snapshotTree.snapshot.id);
            System.log("state: "+snapshotTree.state.value);
            var childSnapshotList = snapshotTree.childSnapshotList;
            if(childSnapshotList != null){
                System.log("childSnapshotList length: "+snapshotTree.childSnapshotList.length);
            }
            System.log("");
        }
        if(snapshotTree.childSnapshotList != null){
            System.log("Children found: "+snapshotTree.childSnapshotList.length);
            for each (childSnapshotTree in snapshotTree.childSnapshotList){
                showSnapshotInfo(childSnapshotTree, selectedSnapshot);
            }
        }
    }
    

    During the passage of one of my virtual machines, here is an example of output I get:

    [2014-06-12 15:19:21.493] [I] Snapshot Tree Count: 1
    [2014-06-12 15:19:21.493] [I] ====================
    [2014-06-12 15:19:21.494] [I] Name: before upgrade to 5.0.1
    [2014-06-12 15:19:21.494] [I] Id: 31
    [2014-06-12 15:19:21.494] [I] Description:
    [2014-06-12 15:19:21.495] [I] createTime: Mon Mar 19 2012 13:48:57 GMT-0400 (EDT)
    [2014-06-12 15:19:21.495] [I] quiesced: false
    [2014-06-12 15:19:21.495] [I] replaySupported: null
    [2014-06-12 15:19:21.495] [I] backupManifest: null
    [2014-06-12 15:19:21.496] [I] snapshot id: snapshot-83
    [2014-06-12 15:19:21.496] [I] state: poweredOff
    [2014-06-12 15:19:21.496] [I] childSnapshotList length: 1
    [2014-06-12 15:19:21.496] [I]
    [2014-06-12 15:19:21.497] [I] ====================
    [2014-06-12 15:19:21.497] [I] Name: Before 5.1 upgrade
    [2014-06-12 15:19:21.497] [I] Id: 36
    [2014-06-12 15:19:21.497] [I] Description:
    [2014-06-12 15:19:21.498] [I] createTime: Fri Sep 21 2012 21:59:58 GMT-0400 (EDT)
    [2014-06-12 15:19:21.498] [I] quiesced: false
    [2014-06-12 15:19:21.498] [I] replaySupported: null
    [2014-06-12 15:19:21.498] [I] backupManifest: null
    [2014-06-12 15:19:21.499] [I] snapshot id: snapshot-84
    [2014-06-12 15:19:21.499] [I] state: poweredOff
    [2014-06-12 15:19:21.499] [I] childSnapshotList length: 1
    [2014-06-12 15:19:21.499] [I]
    [2014-06-12 15:19:21.500] [I] ====================
    [2014-06-12 15:19:21.500] [I] Name: Before Named Instance
    [2014-06-12 15:19:21.500] [I] Id: 37
    [2014-06-12 15:19:21.501] [I] Description:
    [2014-06-12 15:19:21.501] [I] createTime: Mon Nov 11 2013 13:40:46 GMT-0500 (EST)
    [2014-06-12 15:19:21.501] [I] quiesced: false
    [2014-06-12 15:19:21.501] [I] replaySupported: null
    [2014-06-12 15:19:21.502] [I] backupManifest: null
    [2014-06-12 15:19:21.502] [I] snapshot id: snapshot-236
    [2014-06-12 15:19:21.502] [I] state: poweredOff
    [2014-06-12 15:19:21.502] [I]
    
  • RDM for several virtual machines on the same LUN

    Hi, I have a requirement for multiple virtual machines to have access to the same LUN filestore. I think create ROW for each virtual computer to the LUN. I wanted to ask if this is possible and if someone put in place before?

    Are there issues making this record to file/san locks?

    Thank you

    Once you add the raw device map to a virtual computer, you can not add it to each other as well.

    It would satisfy your requirement to add to a virtual computer, assign it a drive name or folder, then that spread out and have another card SMV a drive to it?  Depending on what you're trying to do, which can satisfy because it will work.

    Rich

  • WAIT % - % IDLE, what is the average for a virtual machine?

    I did some research on performance of VM problems and worked with the media to see that there is maybe a bottle neck IO that occur with a virtual VMware machine I have performance problems on. The technician found that the WAITING % - % IDLE on average for this virtual machine is around 200%. The tech said it was abnormally high. I forgot to ask her what was normal but wanted to put a post to see if some people out there know what they are on average. What is an average number of see? I have the system done nothing right now and I see 579% waiting and 372% IDLE. The technology has been able to confirm that no IO queue was occurring in the VMkernel or on the HBA controller.

    Some average % positions would be useful. Thank you.

    gdewulf18480 wrote:

    Supposibly the amount of time in a State of waiting for I/O is the WAIT - IDLE % difference. I was wondering if anyone had the numbers for this feeling. Is there anyone with some of them?

    Q: How will I know the VCPU world waiting for I/O events?

    A: WAIT - % IDLE % can give you an estimate on how much time processor is spent waiting for I/O events. It is an estimate only, because the world wait perhaps for other than the i/o resources. Note that we should do it only for the worlds of the WWW, not the other kind of worlds. Because the VMM worlds represent the best guest behavior. For the disk i/o, another alternative is to read the disk latency stats that we explain in the drive section.

    WAIT % by itself cannot be used, you must develop and examine the individual vCPU % EXPECTATION values and subtract their idle time.  You can't do it on the initial view of a single line by VM CPU in esxtop.  If technology that you mentioned did not explain it, he doesn't know what it takes.

    I have lots of virtual machines that are never less than 300% when I wait - % idle and I have no problems.

    It is an example, I caught NimSoft server:

    DHSNMS1 100 100 5 192.63 193,80 0.24 0.03 291,44 1.04

    %EST USED (s) 192 - in other words, almost two processors are used 100%

    The %Idle is 1.04% WAIT 291.44 - according to the calculation of waiting idle, I have a super serious problems of e/s past  But this isn't the case, and expanding, I can see that.

    5665 vmware-vmx 100 1 0.09 0.11 100.00 0.00 0.00 0.01

    5667 100 vmassistant.566 1 0.62 0.65 99,63 0.00 0.00 0.00

    5703 100 mks:DHSNMS1 1 0.01 0.01-100.00 0.00 0.00 0.00

    5704 vcpu 100 - 0:DHSNMS1 1 32,35 32.88 67,28 0.28 0.11 67,14

    5705 vcpu 100 - 1:DHSNMS1 1 31,58 32.05 68.11 0.00 67.85 0.12

    So the changed values unfortunately because of ESXTOP bike when you develop... which is annoying, but anyway.  In this you see % waiting is 67 and 68 with another respectively being 3 to 100% (which is normal) and the idle being %, 0, 0, 0, 67 and 67.8.  Doing the calculation on the processors shows a wait - slowed virtually 0 - or very little IO wait past with processors.  But if you add up all the expectations of % and % is idling, you have 434ish, and the 134ish and do the calculation is the difference of 300 - which is the 3 who are always 100%.

    So there is no way we can answer your question, we can only help you to understand how the values should be interpreted.

    Waiting for i/o States almost always go on the disc anyway, it is unlikely, therefore, the network or the user entered, looking at the stats of disc ESXTOP is a much better way to determine if there is a problem of e/s.

  • How to change network name for all virtual machines within the same cluster

    We have recently changed name vswitch to take into account that something significant, in the past vCenter could change the labels of networh for all virtual machines... seems this time help labels are not changed (maybe its got something to do with the update vcenter for 2.5.U3)...

    in any case, someone at - it a powershell script that could find all the virtual machines that are referring to the old label network and then changing again the name... ?

    Enjoy the respponses...

    Thanks in advance

    A few things on this blog could help.

    If you know the names you want to use, you could also just use something like:

    Get-Cluster X | Get-VM | Get-NetworkAdapter | Where { $_.NetworkName -eq "OldNetwork" } | Set-NetworkAdapter -NetworkName "NewNetwork" -confirm:$false
    Get-Cluster X | Get-VM | Get-NetworkAdapter | Where { $_.NetworkName -eq "NewNetwork" } | Set-NetworkAdapter -Connected:$true -confirm:$false
    
  • Help: Cannot clone a snapshot for a virtual machine that is turned off

    Hi guys

    I am currently using VMWare Workstation 10.0.3 build-1895310

    (The latest available at the time of writing)

    I want to create a clone of a snapshot.

    The snapshot is on the two snapshots behind 'You are here' - the current state.

    The computer virtual running windows server 2012.

    The virtual machine is completely turned off.

    (the virtual machine was turned off within the BONE, and no 'Power Off' option is available in the menu 'Power' after the OS is turned off, indicating (as far as I can tell) that the virtual machine is turned off completely)

    However, when you try to create a clone of the snapshot, the dialog box indicates that the virtual machine must be fed first (which I think it is) before making a clone.

    The only option available in the dialog box is "Cancel". (ie - the cloning process cannot continue)

    The attached picture shows the dialog of Clone, indicating the issue - and behind it, the engine power VM off

    (I'm trying to clone the snapshot "Installation")

    In other words, I have a completely powered off power VM (as far as I know), but it is impossible to create a clone of a snapshot, as VMWare seems to think that it is always active, for some unknown reason...

    Am I something wrong / missing something?

    Please advise...

    Thanks in advance

    James

    Welcome to the community,

    the reason is that the virtual machine has been turned on at the time you created the snapshot. What you can do is to clone the virtual disk manually using the command line of vmware-vdiskmanager (using the snapshot required as the source hard) and then create a new virtual machine by using the virtual disk cloned rather than creating a new.

    André

  • Change tracking (CTK) block is supported for this virtual machine, but was refused. This will increase the CPU proxy and consumption of IOP.

    I have problems with a client of VMware image-level in an EMC Avamar backup.  So far, we have not been able to find information about this message in the backup log file.  It is originally the backup to take a very long period of time (on average 10-11 hours).

    2014-02-28 14:20:57 avvcbimage < 14681 > Info: change tracking (CTK) block is supported for this virtual machine, but was refused. This will increase the CPU proxy and consumption of IOP.

    We cannot determine why CBT is "denied".  Has anyone here run across this issue before or seen any other type of backup VMware image have denied CBT?

    Everything I checked watch that CBT is successfully activated since the file vmx for the customer to the Avamar config.

    ESXi host is Enterprise Plus 4.1.0 260247

    After spending some time on this issue, the ultimate resolution withdrew the Avamar vm and then add it again.  After that, CBT began to work properly.  It seems that there is a parameter that has been 'stuck' pertaining to this virtual machine that wasn't behaving properly.

  • Disable the clichés for individual virtual machines?

    Hi all

    Is it possible to disable support for snapshot for individual virtual machines, perhaps via a parameter for it?  Or is the closest answer you to put all its virtual disks in independent mode?  Try to see how to better meet the requirements that certain suppliers impose that the VM/device does not catch instant and thought that the best solution is to disable the feature for the specific VM (s) only.  Thank you!

    You can watch the snapshot.maxSnapshots configuration setting. See KB 1031280 for more information.

  • 'Disable the alarm action' for a virtual machine

    Hello

    I want to disable all actions for a virtual machine alarm, while I have to disable FT to clone a virtual machine. My script are ready for cloning but I have a solution to disable the actions of alarm for a virtual machine via PowerCLI to can´t. Someone knows a solution for PowerCLI 5.1R1?

    Thank you

    Michael

    -Entity parameter requires an inventory of PowerCLI as value object and does not have the names. You can try it like this:

    Get-AlarmActionState-entity (Get-VM-name VMTEST1) - Recurse: $false

  • How to find the latest version of material available for a virtual computer

    Hi, I have a problem to upgrade the hardware of the VMS version.

    My $vm = Vim::find_entity_view (view_type = > 'VirtualMachine', filter = > {'name' = > $vm_name});

    $vm-> UpgradeVM();

    Call to the UpgradeVM method I sometimes get an error saying: compatibility of the virtual machine is already up to date

    I can get the latest version of hardware verification $vm - > config-> version, but I don't know whether it is the latest version of material available. How can I find out who is the latest material available for a virtual machine before you upgrade?

    Thanks in advance.

    You can retrieve the list of configurations of operating systems, virtual material, supported, capabilities, etc. using the http://pubs.vmware.com/vsphere-51/index.jsp?topic=%2Fcom.vmware.wssdk.apiref.doc%2Fvim.EnvironmentBrowser.html EnvironmentalBrowser

    For the version of VTM, take a look at the QueryConfigOptionDescriptor() that returns a list of the ESXi hosts and VTM version, he takes in charge. Joint a screenshot using the vSphere MOB

  • How can we change the disc type of thin thickness of a virtual machine?

    Hello

    We use vSphere vCenter 5.0, 5.0. How can we change the disc type of thin thickness of a virtual machine?

    Kind regards

    ZaraRose.

    Storage vMotion, cold migration, vmkfstools and VMware Converter

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

  • Can join a Cluster of storage disk out of Maintenance DTS Mode to set up the profiles for a virtual machine storage policies?...

    Can join a Cluster of storage disk out of Maintenance DTS Mode to set up the profiles for a virtual machine storage policies?...


    IE can you define the rules of affinity DTS depending on how the rules of storage of profiles are configured for a virtual machine?

    In my mind it seems there is disconnect from the DTS and storage profiles.

    Thank you.

    = NOTE =.

    My lab at home, 2 organizes running ESXi 5.0

    Dv01 has

    Of startup vmfs 7200 RPM 160 G = dv01-BOOT

    Vmfs 1 TB 7200 RPM = VM02-VMFS

    VM02 has

    Of startup vmfs 7200 RPM 160 G = VM02-BOOT

    Vmfs 1 TB 7200 RPM = VM02-VMFS

    Vmfs 5900 RPM 2 TB = VM02-TV01

    I have (3) facility profiles of storage using 'User-defined storage Capablity' as shown below:

    (160 @ 7200 RPM SATA) boot > Boot

    Fast (160 7200 RPM SATA and 1 TB @ 7200 RPM SATA) > fast

    Slow (2 TB @ 5900 RPM SATA) > slow

    Then, I set up a storage Cluster with my local disks on dv01 (only to date)

    LocalVM disc dv01-BOOT and dv01-VMFS disk of the 'cluster of storage.

    I have a computer virtual called DC01 (HardDisk1) want to live on 'Boot' profile storage drive
    His "Non-compliant" poster according to the storage profile, it should run on drive 'boot' on dv01

    To get to this point, I put the StorageCluster in Mode of Maintenace 'DTS' and forced a sVmotion of all virtual machines off dv01-BOOT

    No disks are IO or claim of space.

    But once I take the 'DTS Maintenacne mode' STARTUP dv01 floppy is now get the DTS to return him to satisfy the storage profile (rule) I install... IE do the 'storage profile' VM complient (without doing a few externall API, the PS script or the 3rd party software calls)... ??

    Seems weird it is (or may be) such disconnection of a memory of the profiles and the StorageClusters and the DTS?

    Thank you...

    At this point, I think that storage DRS and storage profiles are two technologies to separate and work independently, but what you suggest is a great idea-

Maybe you are looking for