Add a virtual disk to an existing virtual machine.

Hello

Anyone know what would be the best way to create an action to add a new virtual disk (hard) to an existing virtual computer? I have found no existing action/workflow, and I do not know where to start.

Thank you

Hey Mikael,.

There is a "workflow" for this!

Library / vCenter / Virtual Machine Management / management of devices / add a disk.

This workflow, you can add a VMDK to a virtual machine.

Tags: VMware

Similar Questions

  • Blocking task - add a virtual machine to VAPP

    Which block task will begin when I add a virtual machine to a Palsy of a catlog. The "add, move or delete virtual machines of VAPP" seems to send a job blocking, but the xml of the blocking task does not include the vcloud:vm, only the vcloud:vapp

    I want to send a notification when the new VM is complete provisioning and include details on the new virtual machine.

    If you duplicated one of the workflow approval of all notifications, try to paste the following in the Get scaffolding Scriptable this workflow task... He will certainly need a cleaning according to your needs. It is a part of my test code for extraction of information of this type of operation...

    var vcdHost = vApp.getHost();
    
    //User info
    var username = user.name;
    var userDescription = user.description;
    var userFullName = user.fullName;
    var userEmailAddress = user.emailAddress;
    var userTelephone = user.telephone;
    var userIm = user.im;
    
    var userDeployedVmQuota = user.deployedVmQuota;
    if (userDeployedVmQuota == 0) userDeployedVmQuota = "Unlimited";
    var userStoredVmQuota = user.storedVmQuota;
    if (userStoredVmQuota == 0) userStoredVmQuota = "Unlimited";
    var userRole = vcdHost.getEntityByReference(VclEntityType.ROLE, user.role).name;
    
    System.sleep(5000);
    
    if (blockingTask != null) {
        var task = vcdHost.getEntityByReference(VclEntityType.TASK, blockingTask.getTask());
        task.updateInternalState();
        var XMLstring = task.toXml();
        System.log("Task XML: \n"+XMLstring);
    
        // Now begin typical XML Processing for this set of action types:
        // These come from the "Add, Move or Delete Virtual Machines from vApp" blocking task being enabled
        // This workflow requires a single input - a string containing the XML to be processed.
        // It generates the following outputs:
        // operationType - this is a string that is either "create" "delete" or "move"
        // the other output is a Array/Properties object with the following possible properties:
        // vmName - string
        // hostName - string
        // osName - string
        // hwVersion - string
        // cpuCount - string
        // memoryMB - string
        var doc = new XML(XMLstring);
        default xml namespace = doc.namespace();
        // initialize the outputs:
        var operationType = null;
        var vmPropsArray = new Array();
    
        // Determine action type from XML:
        if (doc.Params.DeleteItem != null && doc.Params.DeleteItem.length() > 0){
            System.log("This is a Delete operation");
            operationType = "delete";
            //    DELETE ITEM Processing
            System.log("DeleteItem Count: "+doc.Params.DeleteItem.length());
            for each (c in doc.Params.DeleteItem){
                var vmProps = new Properties();
                System.log("VM to Delete: "[email protected]());
                vmProps.put("vmName",[email protected]());
                vmPropsArray.push(vmProps);
            }
        }
        if(doc.Params.CreateItem != null && doc.Params.CreateItem.length() > 0){
            System.log("A blank VM is being added to the vApp");
            operationType = "create";
            System.log("CreateItem Count: "+doc.Params.CreateItem.length());
            for each (c in doc.Params.CreateItem){
                var vmProps = new Properties();
                System.log("VM to Add: "[email protected]());
                System.log("Description: "+c.Description.toString());
                vmProps.put("vmName",[email protected]());
                vmProps.put("description",c.Description.toString());
                vmProps.put("hostName","n/a");
                vmProps.put("osName","n/a");
                vmProps.put("cpuCount","n/a");
                vmProps.put("memoryMB","n/a");
                vmPropsArray.push(vmProps);
            }
        }
        // ADD/MOVE Testing:
        if(doc.Params.SourcedItem != null){
            System.log("SourcedItem Count: "+doc.Params.SourcedItem.length());
            for each (c in doc.Params.SourcedItem){
                var vmProps = new Properties();
                System.log("=============================");
                if(c.@sourceDelete == "true"){
                    operationType = "move";
                }else{
                    operationType = "create";
                }
                System.log("This is an "+operationType+" operation");
                //System.log("sourceDelete: "+c.@sourceDelete);
                var instantiationParams = c.InstantiationParams;
                vmProps.put("vmName",instantiationParams.GuestCustomizationSection.ComputerName.toString());
                System.log("VM Name: "+instantiationParams.GuestCustomizationSection.ComputerName.toString());
    
                vmProps.put("hostName",instantiationParams.*::VirtualHardwareSection.*::System.*::VirtualSystemIdentifier.toString());
                System.log("Host Name: "+instantiationParams.*::VirtualHardwareSection.*::System.*::VirtualSystemIdentifier.toString());
    
                vmProps.put("osName", instantiationParams.*::OperatingSystemSection.*::Description.toString());
                System.log("Operating System: "+instantiationParams.*::OperatingSystemSection.*::Description.toString());
    
                vmProps.put("hwVersion",instantiationParams.*::VirtualHardwareSection.*::System.*::VirtualSystemType.toString());
                System.log("Hardware Version: "+instantiationParams.*::VirtualHardwareSection.*::System.*::VirtualSystemType.toString());
    
                var n2 = new Namespace("http://schemas.dmtf.org/ovf/envelope/1");
                var n3 = new Namespace("http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ResourceAllocationSettingData");
                var items = instantiationParams.*::VirtualHardwareSection.n2::Item;
                for each (i in items){
                    if(i.n3::Description.toString() == "Number of Virtual CPUs"){
                        vmProps.put("cpuCount",i.n3::VirtualQuantity.toString());
                        System.log("CPU Count: "+i.n3::VirtualQuantity.toString());
                    }
                    if(i.n3::Description.toString() == "Memory Size"){
                        vmProps.put("memoryMB",i.n3::VirtualQuantity.toString());
                        System.log("Memory (MB): "+i.n3::VirtualQuantity.toString());
                    }
                }
                vmProps.put("description","n/a");
                vmPropsArray.push(vmProps);
            }
        }
    }
    
    //vApp Info
    var vAppName = vApp.name;
    var vAppDescription = vApp.description;
    var vAppVdc = vApp.parent.name;
    var org = vApp.parent.parent;
    
    //Using query service to get further information on the to be deployed vApp
    var queryService = vcdHost.toAdminObject().toAdminExtensionObject().getExtensionQueryService();
    var expression = new VclExpression(VclQueryVAppField.NAME, vApp.name, VclExpressionType.EQUALS);
    var filter = new VclFilter(expression);
    var params = new VclQueryParams();
    params.setFilter(filter);
    
    var resultSet = queryService.queryAllVappRecords(params);
    while (resultSet != null) {
        var records = resultSet.getRecords();
        for each (var record in records) {
            //Since we got the vApp by its name we want to check it is the right one
            if (record.href == vApp.getReference().href) {
                var vAppCreationDate = VclMiscObjectFactory.convertToGregorianCalendar(record.creationDate).toString();
                var vAppNumberOfVMs = record.numberOfVMs;
                var vAppStorageMB = record.storageKB / 1024;
                var map = record.otherAttributes;
                var vAppAutoDeleteDate = "Unlimited";
                for each (k in map.keys) {
                    if (k.getLocalPart() == "autoDeleteDate") {
                        var vAppAutoDeleteDateString = map.get(k);
                        if  (vAppAutoDeleteDateString != null && vAppAutoDeleteDateString != undefined) {
                            var vAppAutoDeleteDateXmlGregorianCalendar = VclMiscObjectFactory.xmlGregorianCalendarFromString(vAppAutoDeleteDateString);
                            var vAppAutoDeleteDate = VclMiscObjectFactory.convertToGregorianCalendar(vAppAutoDeleteDateXmlGregorianCalendar).toString();
                        }
                        System.log(k.getLocalPart() + " : " + map.get(k));
                    }
                }
            }
        }
        resultSet = resultSet.getNextPage();
    }
    
    var vmsProperties = new Array();
    
    var queryService = vcdHost.getQueryService();
    expression = new VclExpression(VclQueryVMField.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) {
            var vmProp = new Properties();
            vmProp.put("guestOs", record.guestOs);
            vmProp.put("memoryMB", record.memoryMB);
            vmProp.put("numberOfCpus", record.numberOfCpus);
            if (record.networkName != null) {
                vmProp.put("networkName", record.networkName);
                }
            else {
                vmProp.put("networkName", "");
            }
            vmProp.put("name", record.name);
            vmProp.put("description","n/a");
            vmsProperties.push(vmProp);
        }
        resultSet = resultSet.getNextPage();
    }
    
    function addInfoTitle(info, title) {
        info += "" + title + "
    \n"; return info; } function addInfoEntry(info, label, entry) { info += "
  • " + label + " : " + entry + "\n"; return info; } function addInfoSeparation(info) { info += "

\n"; return info; } content = ""; content = addInfoTitle(content, "Requestor"); content = addInfoEntry(content, "Username", username); content = addInfoEntry(content, "Description", userDescription); content = addInfoEntry(content, "Full Name", userFullName); content = addInfoEntry(content, "Email Address", userEmailAddress); content = addInfoEntry(content, "Telephone Number", userTelephone); content = addInfoEntry(content, "Instant Messenger ID", userIm); content = addInfoEntry(content, "Deployed VM Quota", userDeployedVmQuota); content = addInfoEntry(content, "Stored VM Quota", userStoredVmQuota); content = addInfoEntry(content, "Role", userRole); content = addInfoSeparation(content); content = addInfoTitle(content, "vApp"); content = addInfoEntry(content, "Name", vAppName); content = addInfoEntry(content, "Description", vAppDescription); content = addInfoEntry(content, "VDC", vAppVdc); content = addInfoEntry(content, "Creation Date", vAppCreationDate); content = addInfoEntry(content, "Number of VMs", vAppNumberOfVMs); content = addInfoEntry(content, "Disk Size", System.formatNumber((vAppStorageMB / 1024), "0")+ " GB"); content = addInfoEntry(content, "Storage Lease", vAppAutoDeleteDate); System.log("=================================================\n"); System.log("Operation Type: "+operationType); // Process the vmPropsArray: // vmName - string // hostName - string // osName - string // hwVersion - string // cpuCount - string // memoryMB - string if (vmPropsArray != null){ for each (vmProps in vmPropsArray){ System.log("vmName: "+vmProps.get("vmName")); System.log("hostName: "+vmProps.get("hostName")); System.log("osName: "+vmProps.get("osName")); System.log("cpuCount: "+vmProps.get("cpuCount")); System.log("memoryMB: "+vmProps.get("memoryMB")); content = addInfoSeparation(content); content = addInfoTitle(content, "VM"+" ("+operationType+")"); content = addInfoEntry(content, "\tName", vmProps.get("vmName")); // This is the "Full Name" or "Display Name" if(vmProps.get("description")!="n/a"){ content = addInfoEntry(content,"\tDescription", vmProps.get("description")); } if(vmProps.get("hostName")!="n/a"){ content = addInfoEntry(content, "\tHost Name", vmProps.get("hostName")); // This is the hostname or Computer Name } if(vmProps.get("osName")!="n/a"){ content = addInfoEntry(content, "\tGuest OS name", vmProps.get("osName")); } if(vmProps.get("cpuCount")!="n/a"){ content = addInfoEntry(content, "\tvCPUs", vmProps.get("cpuCount")); } if(vmProps.get("memoryMB")!="n/a"){ content = addInfoEntry(content, "\tRAM (MB)", vmProps.get("memoryMB")); } // content = addInfoEntry(content, "\tNetwork name", vmProp.get("networkName")); } } var displayContent = content; // Retrieve the full webview url here: should be like http://your.vco.server:8280/vmo/approvals var webViewUrl = configurationElement.getAttributeWithKey("webViewUrl").value; // Extract the host from the url var vcoHost = webViewUrl.match(/^(ftp:\/\/|https?:\/\/)?(.+@)?([a-zA-Z0-9\.\-]+).*$/)[3]; // Now build the answer URL to be placed in e-mail var urlAnswer = "here" ; content = addInfoSeparation(content); content += "Click "+urlAnswer +" to approve or reject this request."; content = addInfoSeparation(content); content += "** This is an automated workflow email. Do not reply. **";
  • Unable to add the virtual machine to inventory

    Unable to add the virtual machine to inventory

    Hi assane, is vmware-cmd same available on ESXi 5.0 and later versions?

    To the OP:

    If you use 5.0 or later ESXi, vmware-cmd will not work. Alternatively, you can use:

    Vim - cmd solo/registervm /vmfs/volumes/datastore_name/VM_directory/VM_name.vmx

    That said, it could be several reasons of failure regarding the registration of the VM. Can put you up a screenshot of the error / symptom you see when it breaks down?

  • Can I add a virtual machine to a dvswitch without using vcentre?

    Afternoon,

    Our vcentre is not set up to handle the dvswitches on the host - bit of a long story.

    Until he does, can we use the command line to add a virtual machine to a dvswitch?

    If so, can someone help me with this?

    Thank you

    Martin

    vCenter is required to set up and manage a distributed switch.

  • Add VMFS5 virtual machine disk using Perl SDK

    Hello

    Each of my VM has only a single disc on nfs datastore

    9 VirtualLsiLogicController = HASH (0x46f5bc0)

    "busNumber' = > 0

    'controllerKey' = > 100

    'device' = > ARRAY (0x520e190)

    0 2000

    "deviceInfo" = > Description = HASH (0x520e148)

    'label' = > ' controller SCSI 0'

    'Summary' = > 'LSI Logic.

    'hotAddRemove' = > 1

    'key' = > 1000

    'scsiCtlrUnitNumber' = > 7

    'sharedBus' = > VirtualSCSISharing = HASH (0x520de78)

    'val' = > 'noSharing '.

    I need an option to add a new disk that is located on another data store (Serial attached SCSI for each ESXi disk)


    dsbrowse.pl - name dscs1-vp-sb1

    Summary

    Name: vp-dscs1-sb1

    Location: ds: / / / vmfs/volumes/5309af02-0ba1ac70-e723-10604bb454c8 /.

    File system: VMFS

    Maximum capacity: 931,25 GB

    Available space: 930.2978515625 GB

    I tried to use a vdiskcreate.pl, but it is not an option to use different data store for a new drive and always creates a new drive on a nfs datastore.

    It is fairly easy to do with a wizard, but I have to run it ~ 50 times

    Thank you

    $devspec = VMUtils::get_vdisk_spec (vm => $entity_view,)
    backingtype-online 'normal time ',.
    diskMode-online $diskMode,
    file name => $vm_disk_filename.
    controllerKey-online $controllerKey,
    unitNumber-online $unitnumber,
    size-online $disksize);

    You must specify the new data store name in the file name variable.

    for example $vm_disk_filename = "[new_datastore] tstvm/tstvm.vmdk".

  • Unable to add the virtual machine network services

    Hello:

    I already read that warning Virtual PC 2007 is not compatible with win 7-64.
    However, I read that it is "unofficially" possible launch.
    OK, I installed it and it worked except networking.
    Basically, I need to install the Virtual Machine Network Services.
    I right click on my network card-> properties-> install-> services-> virtual machine network services (VPC2007 folder: where I can see VMNetSrv.inf)
    Then says Windows: it is impossible to add the requested feature. The specified service has been marked for deletion.

    The problem is that I get this error even on WinXP SP3, so I think that there is something else wrong.

    And of course, Virtual PC 2007 available networks are only: no connection, Local, NAT.  (Missing my physical adapter)

    Thank you!!!

    Hello

    The question you posted would be better suited to the TechNet community. Please visit the link below to find a community that will provide the support you want.

    Hope this information is useful.

  • Add multiple virtual machines to the inventory at once?

    Hello

    Add virtual machines to the inventory, I need to browse the data store, get him the virtual machine folder, click with the right button on the vmx file and add it to the inventory. If I have to do for 100 virtual machines, that it takes a lot of time.

    Is there a way I can add multiple virtual computers to inventory collectively without doing it for each individual computer?

    Rizwan

    Not with vSphere client if this is what you need.

    If this post was useful/solved your problem, please mark the points of wire and price as seem you. Thank you!

  • Add multiple virtual machines to a running script

    Hi all

    This script below works fine

    $vmtest = get - vm "vmname" | Get-opinion

    $vmConfigSpec = new-Object VMware.Vim.VirtualMachineConfigSpec

    $vmConfigSpec.changeTrackingEnabled = $true

    $vmtest.reconfigVM ($vmConfigSpec)

    How can I pass a list of virtual machines in a text file c:\vms.txt for this script?

    Thank you

    Alex

    I guess your TXT file has a vmname on each line, so you might do something like this

    $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec$vmConfigSpec.changeTrackingEnabled = $true
    
    Get-Content c:\vms.txt | %{  $vmtest = Get-vm -Name $_  $vmtest.ExtensionData.ReconfigVM($vmConfigSpec)}
    
  • How to add a virtual machine?

    I had a VM sent me a file .ova that I can not find a function to import and Virtual Appliances expects a .ovf how to make a .ova in my VMware ESXi?

    You should be able to import .ova by using the Client vSphere in respect of the import of the model .ovf. If this isn't the case, you may need to use the ovftool before you import it.

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    http://Twitter.com/lamw

    If you find this information useful, please give points to "correct" or "useful".

  • Display - Add a virtual machine to the pool already configured?

    Hello

    Is there a way to 5 awarded VMs to an already configured manual pool?

    Thank you

    Peter.

    look at the inventory of this particular pool.

  • How to add a script to a virtual machine using vmwrae api?

    Hello

    I am trying to add a new disk to an existing VM (Linux).

    To do this.


    Now to use the new drive on a run a series of commands, like:

    -format the drive

    -mount the drive

    -put this information to disk in the file/etc/fstab


    My question is how we can automate this task without actually going inside the virtual machine?

    This is precisely what my advice is intended to accomplish. There are many examples available online to use Invoke-VMScript to automate actions in a Linux VM.

    http://www.Google.com/search?q=invoke-vmscript+examples

    This was done from my Windows using PowerCLI workstation to a virtual machine running SLES:

    PowerCLI C:\> Invoke-VMScript -vm $vm -HostCredential $hc -GuestCredential $gc -ScriptText "uptime"
    
    ScriptOutput
    ---------------------------------------------------------------------------------------------------
     08:32:52 up 88 days,  7:27,  0 users,  load average: 0.00, 0.00, 0.00
    |
    ---------------------------------------------------------------------------------------------------
    
  • How to modify a Virtual Machine DRS existing group?

    Hello

    I use DRS-rules to place virtual machines to a host selected in a Cluster group.

    The poblem is that I did not find methods to change (add new virtual machines) to an existing group of DRS 'Virtual Machine '.

    As far as I know, the configuration is stored in $ClusterView.ConfigurationEx.Group

    Any ideas?

    Thank you!

    Hi Willibald,

    I did some research in the VMware vSphere SDK and made two functions Get-DrsGroup and VmToDrsGroup Add to add one or more virtual machines to a ClusterVmGroup. Some examples of how to use these function exists in the code. If you have added these features to your PowerCLI session, you can use Get-Help to get information about these functions. And also for the examples. For example Get-Help add-VmToDrsGroup-full.

    Function Get-DrsGroup {
    <#
    .SYNOPSIS
    Retrieves DRS groups from a cluster.
    
    .DESCRIPTION
    Retrieves DRS groups from a cluster.
    
    .PARAMETER Cluster
    Specify the cluster for which you want to retrieve the DRS groups
    
    .PARAMETER Name
    Specify the name of the DRS group you want to retrieve.
    
    .EXAMPLE
    Get-DrsGroup -Cluster $Cluster -Name "VMs DRS Group"
    Retrieves the DRS group "Vms DRS Group" from cluster $Cluster.
    
    .EXAMPLE
    Get-Cluster | Get-DrsGroup
    Retrieves all the DRS groups for all clusters.
    
    .INPUTS
    ClusterImpl
    
    .OUTPUTS
    ClusterVmGroup
    ClusterHostGroup
    
    .COMPONENT
    VMware vSphere PowerCLI
    #>
    
      param([parameter(Mandatory=$true, ValueFromPipeline=$true)]$Cluster,
            [string] $Name="*")
    
      process {
        $Cluster = Get-Cluster -Name $Cluster
        if($Cluster) {
          $Cluster.ExtensionData.ConfigurationEx.Group | `
          Where-Object {$_.Name -like $Name}
        }
      }
    }
    
    Function Add-VMToDrsGroup {
    <#
    .SYNOPSIS
    Adds a virtual machine to a cluster VM DRS group.
    
    .DESCRIPTION
    Adds a virtual machine to a cluster VM DRS group.
    
    .PARAMETER Cluster
    Specify the cluster for which you want to retrieve the DRS groups
    
    .PARAMETER DrsGroup
    Specify the DRS group you want to retrieve.
    
    .PARAMETER VM
    Specify the virtual machine you want to add to the DRS Group.
    
    .EXAMPLE
    Add-VMToDrsGroup -Cluster $Cluster -DrsGroup "VM DRS Group" -VM $VM
    Adds virtual machine $VM to the DRS group "VM DRS Group" of cluster $Cluster.
    
    .EXAMPLE
    Get-Cluster MyCluster | Get-VM "A*" | Add-VMToDrsGroup -Cluster MyCluster -DrsGroup $DrsGroup
    Adds all virtual machines with a name starting with "A" in cluster MyCluster to the DRS group $DrsGroup of cluster MyCluster.
    
    .INPUTS
    VirtualMachineImpl
    
    .OUTPUTS
    Task
    
    .COMPONENT
    VMware vSphere PowerCLI
    #>
    
      param([parameter(Mandatory=$true)] $Cluster,
            [parameter(Mandatory=$true)] $DrsGroup,
            [parameter(Mandatory=$true, ValueFromPipeline=$true)] $VM)
    
      begin {
        $Cluster = Get-Cluster -Name $Cluster
      }
    
      process {
        if ($Cluster) {
          if ($DrsGroup.GetType().Name -eq "string") {
            $DrsGroupName = $DrsGroup
            $DrsGroup = Get-DrsGroup -Cluster $Cluster -Name $DrsGroup
          }
          if (-not $DrsGroup) {
            Write-Error "The DrsGroup $DrsGroupName was not found on cluster $($Cluster.name)."
          }
          else {
            if ($DrsGroup.GetType().Name -ne "ClusterVmGroup") {
              Write-Error "The DrsGroup $DrsGroupName on cluster $($Cluster.Name) doesn't have the required type ClusterVmGroup."
            }
            else {
              $VM = $Cluster | Get-VM -Name $VM
              If ($VM) {
                $spec = New-Object VMware.Vim.ClusterConfigSpecEx
                $spec.groupSpec = New-Object VMware.Vim.ClusterGroupSpec[] (1)
                $spec.groupSpec[0] = New-Object VMware.Vim.ClusterGroupSpec
                $spec.groupSpec[0].operation = "edit"
                $spec.groupSpec[0].info = $DrsGroup
                $spec.groupSpec[0].info.vm += $VM.ExtensionData.MoRef
    
                $Cluster.ExtensionData.ReconfigureComputeResource_Task($spec, $true)
              }
            }
          }
        }
      }
    }
    

    Best regards, Robert

    I changed the error handling logic in the Add-VMToDrsGroup function.

    Post edited by: RvdNieuwendijk

  • cloning of an existing virtual machine

    Hello

    I would like to clone an existing virtual machine. Is this possible with VMware Server 2.0. I want to avoid the hollow will creat a whole new machine virtual process since what I need is already here with the exception of a patch to the version of the JVM.

    Hi, yes you can do it.

    Close the vm to be cloned (cleanly).

    Copy all the files that make up the virtual machine to a new directory in the same or a new data store.

    the web UI, click the host, then select 'Add the virtual machine to inventory' Browse warehouses of data in your vm copied, then select it.

    Start the new virtual machine, when prompted answer that the virtual machine has been copied.

    make changes to the virtual machine (sysprep if you can) change the name of the computer, static ip, license etc. According to os

    Start the original virtual machine

    This should be it.

    Good luck

  • Script to add the virtual computer to the inventory of different data warehouses

    I need a script that will go through all available databases and add the virtual machine inside of them in inventory.


    I know how to do this with:

    New-VM - VMFilePath ' [DATASTORE] vmfolder/vmname.vmx "-VMHost (Get-Cluster"NOMCLUSTER"|) Get-VMHost | Get - Random) - place (Get-folder folder_name) - RunAsync

    But we have hundreds of data stores and thousands of virtual machines. I suck at writing scripts in a loop, but it looks like that's what I need. I tried using wildcards for the VMFilePath - but it does not work. Must be another way.

    Any help would be greatly appreciated!

    Oh, I fixed it. I had a host that was plundered with partial connectivity to storage. The script was repeatedly tries to connect to this host jacked up.

    I managed to work around the problem by changing "Get-VMHost | Select - first 1 "to" Get-VMHost | Get-Random.

    Works fine now... as do all things Luke and Lam

  • Add virtual machines to a data store while changing the name?

    I am trying to create a virtual machine in standby (or more, I do not have a final number) in a second datacenter.  The goal is to have a copy of a group of virtual machines updated once a week as a relief.

    I'll use our SAN replication to keep them up-to-date, so once a week, I stop all virtual machines in the data store, remove them from the inventory and remove the data store.  Then on the side of SAN, I'll create a new copy of the data store, then add this data store to vSphere.  We will do a few rounds of network to ensure we have not any change in the network that should be taken in the virtual machine.

    The only changes to the virtual machine that needs to be done, are changing the vSwitch is logged in, that I understood, and to rename the virtual machine, either before being added, or when it is added.  Since it is a copy of a virtual machine running, I'm not able to add all virtual machines to the new data store.  I need either change the name of the virtual machine before being added, or when it is added.  All I have to do to change the name is add something like - backup at the end of the name of the virtual machine.

    Is it reasonably simple way to do this?  It seems that he was promised that we could do that and now I need to find a way to make it work.

    Thank you

    You can search the data for the VMX store you want to register a script like the one you'll find in VMX Raiders revisited.

    To change the name of the virtual machine, you will need to replace the line that contains the New - VM cmdlet with something like this

    $newName = $VMXFile.DatastoreFullPath.split('/')[1].Split('.')[0]New-VM -VMFilePath $path -Name ($newName + "-backup") -VMHost $ESXHost -Location $VMFolder -RunAsync
    
  • Migration of virtual machines to vSphere 4.1 to vSphere 6.0

    As the title eludes to, we are standing up a new physics 6.0 Server vCenter Server and need to migrate virtual machines of 4.1 6.0 guest hosts.  I'd love to take the time to create a script that does the following; However, before heading down this path, I wanted to do a ping of the group to see if someone has done something like this before or have pointers to scripts that perform some of these actions already.  Some background and concept:

    • Running 4.1.
    • A new physical Center of vCenter 6.0 will be deployed side-by-side with 4.1.
    • The existing configuration of vSphere HA allows for 1-2 guests down without impact to the virtual machines.
    • The two environment and will be Cisco N1KV, SAN access shared for the same data storages.
    • A new vCenter will be lifted.
    • A single host is identified and VMs evacuated to the remaining hosts.
    • This host will be in maintenance mode, removed from the cluster and close.
    • A clean install of ESXi 6 will be done and set up spec.
    • N1KV will be deployed.

    To digress on the details at the moment... Now markets PowerCLI desired.  This idea is ad hoc and on the fly, so as I write this.

    • identify all the virtual machines associated with a specific data store - will need to work with the local client to schedule downtime for virtual machines
    • Stop the virtual machine
    • Remove the VM of the vCenter 4.1 inventory
    • to connect to vCenter 6.0
    • Add the virtual machine to the vCenter 6.0 inventory (and once we have passed the first host in the new cluster, automatically place the virtual machine by using the DRS)
    • Reconfigure the vmnic with the new Cisco 1000V dvs (will be the same name on both sides, but has a different ID)
    • pull in the keys and the values to a CSV and advancedsetting set to harden
    • Turn on the virtual machine
    • Perhaps a test of ping for the NETWORK card to check connectivity

    The order in which the steps are performed can be switched around, as long as the desired end result is the same: migration effectively virtual machines between two disparate solutions with single medium sharing as a data store.  In which I realize will always be VMFS3.  New data stores VMFS-5 is another task for another time.

    Thank you for your time, suggestions, links, etc...

    @LucD - hi.

    These steps are quite possible with PowerCLI.

    See the script after skeleton, he probably needs some adjustments to fit your environment and requirements

    $dsName = "xyz".

    $vm = get - VM - $dsName data store

    Stop-VMGuest - VM $vm - confirm: $false

    Remove-VM - $vm VM - confirm: $false

    Disconnect-VIServer-Server vc41 - confirm: $false

    $vc6 = Connect-VIServer-Server vc6

    $newVM = $vm | New-VM - DiskPath $_. ExtensionData.Config.Files.VmPathName - confirm: $false

    # Suppose a CSV file with

    # Key, value

    # key1, value1

    # key2, value2

    $advSettings = import-Csv - UseCulture advSettings.csv

    {foreach ($obj in $newVM)

    $advSettings | %{

    Get-AdvancedSetting - $obj entity - name $_. Key |

    Game-AdvancedSetting - value of $_. Value - confirm: $false

    }

    }

    Start-VM - $newVM VM - confirm: $false

    $newVM |

    Select Name,

    @{N = "Available"; E = {Test-Connection - ComputerName $_.} Guest.HostName - County 1 - Quiet}}

  • Maybe you are looking for

    • Help I deleted my library and my Mac pro won't start up

      While I was trying to clean my Mac pro because the 750 GB HARD drive had only 30 MB free, I deleted the folder of the library in the system. Because it is only 6 GB and find another folder in the library itself in the HARD drive, I proceeded to back

    • Equium A100-549 itself turns off

      The laptop starts to turn itself turned off (mainly when playing games etc.) which seems to be due to overheating. There is a lot of dust in the vents, etc., so it's probably what is wrong. Can anyone provide guidance on how to disassemble the laptop

    • Satellite C660 - wireless connection works with AC power

      I have problems with the connection Wireless on my laptop. It works when I plug in the power supply. It does not work when the laptop is running off the battery voltage. Is it possible to get the wireless to work without AC power?Thank you

    • Acer aspire 4741G supports 2 sata or sata 3?

      Acer aspire 4741G supports 2 sata or sata 3.? I change just the SSD HARD drive, but I don't know it suport SATA3? Thank you.

    • HP Envy 17 laptop &amp; 5 GHz

      Hello I have a HP Envy 17 laptop PC (product number: F7T68EA #ABU) and I do not see the network wireless 5 GHz with her. I understand that he supported 5 GHz and 2.4, but no joy still see the network - can be seen very well on iPhone and older laptop