Help with the data store migration script

Hey everybody,

I am currently responsible for the migration of disks in new storage. Each virtual computer might have multiple disks on different data warehouses. The script I'm working on that will check the VM for the disks located on a certain store of data, then if necessary to migrate the disk to the new data store. However, I'm lost. I hope I'm at least on the right track. Any help is very appreciated.

Thank you!

$csv = import-Csv-Path "e:\scripts\hunter\vantage_qadev.csv".

foreach ($ent in ($csv))

{

$ds = get-Datastore ' QADEV_OS_HUS127 * ' | Sort descending FreeSpaceGB | Select-Object - 1 first

$vmname = get-VM-name $ent.vmnames

$vmds = $vmname | Get-hard drive | Select file name

If ($vmds - eq "* QADEVOS_VSP986 *") {Get - VM $ent.vmnames |} Get-hard drive | Moving-hard drive - Datastore $ds}

Else {Write-Host "Migration without any preconditions"}

}

That's what I did to make it work. The fact it's supposed to I would say...

$csv = Import-Csv -way "e:\scripts\hunter\vantage_prod.csv".

foreach ($ent in ($csv))

{

$ds = Get-Datastore ' DST_PROD_OS_HUS127 * ' | Sorting FreeSpaceGB -down | Select-Object -First 1

Foreach ($HardDisk in (Get-VM -name $ent.vmnames |)) (( Get - hard drive))

{

$vm = Get-VM -name $ent.vmnames

$hds = Get - hard drive -VM $vm

$lunname = Get-VM -name $ent.vmnames | Get - hard drive | Select-Object -Property @{N = "Datastore"; E = {$harddisk. FileName.Split("]") [0]. TrimStart("[")}}

If ($lunname - like "* DM_PROD_OS_VSP986 *") {Get-VM -name $ent.vmnames |} Get - hard drive | Moving - hard drive { -Data store $ds -confirm: $false}

else {Write-Host $ent.vmnames ' not migrated '}

}

}

What is a better way to do it?

Tags: VMware

Similar Questions

  • Need help with the data storage store, local array and network connections

    Need help with my ESXi 4.1 installation

    My hardware:

    I built a server with an Asus P6T whitebox, i7 920, 12 Gig RAM, NIC, Intel Pro1000 PT Quad, 3ware 9650SE-12ML with 8 1.5 TB SATA green in a raid 6 array gives me about 8 + TB with a spare drive all housed within a NORCO RPC-4220 4U Rackmount Server chassis.  I also have a 500 GB SATA drive which will hold the ESXi and virtual machines.

    The network includes a firewall, Netgear Prosafe FVS336G, GS724Tv of Netgear ProSafe 24 port Gigabit Managed Switch on a dhcp cable modem internet service provider.

    I also have 2 old NetGear SC101T NAS disks (4to) I want to connect to the system how some - at a later date have... data on them and want to transfer to the new storage array. I always looking into the question of whether they will work with ESXi 4.1, or I might have to only access it through Windows XP.

    My Situation:

    I have already installed ESXi 4.1 and vsphere client with no problems and it is connected to a dhcp cable internet service.  I've set up host via a dynamic DNS service name give me a static hostname on the internet.  I installed three machines to virtual OS successfully at the moment and now want to first start by creating a multimedia storage server which will use some of this new 8 TB array, then separate data storage for use with a web server small overhead storage and a backup.  It is a domestic installation.

    Help with the data store and network:

    I was doing some reading, because I'm new to this, and it looks like I'll probably want to set up my table via ESXi as a nfs disk format.  Now, the data store is usually in another physical box from what I understand, but I put my readers and ESXi all in the same box.  I'm not sure that the best way to put in place with grouped network cards, but I want to make this work.

    I understand that in ESXi 4.1 using iSCSi LUN must be less than 2 TB, but nfs - I should be able to add a bigger partition then 2 TB (for my multimedia) in nfs, right? or should I still add it separately as a separate 2 TB drives and then extend them to get the biggest space.

    Any suggestions or direct resources showing examples on how to actually add some parts of the table as data warehouses separate nfs.  I know that to go to the configuration tab, and then select Add to storage, and then select nfs. I have not my picture, but it's here that I don't know what to do because ESXi 4.1 system already has an address, should I put the same thing to the new data store array also (will it work?), and what should I use for the name of the folder and the store of data... just do something to the top.  I thought to later install Openfiler (for a multimedia storage using this table server) as a virtual machine, use the table with esxi so that I can access the same storage space with widows and linux-based systems.

    I also know I have to find a way to better use my quad nic card... put in place of virtual switches, grouping, etc HELP?

    Any direction, assistance, similar facilities to sample, suggestions or resources that would help would be great. I did a lot of hunting, but still a little confused on how to best to put in place.

    You must think of VMDK files of large databases with records of random size guest go read some data (a DLL or an INI file), maybe write some data back, then go read other data. Some files are tiny, but certain DLLs are several megabytes. It's random i/o all and heavy on the search time. IO Opsys is small random operations that are often sequential (go read data, write data, go read other data,...) so that deadlines are critical to the overall performance. That's why people say OPS are / s of reference and forget the MBs flow. The only time where you bulk transfers are when you read media (ISO files).

    Well, now forget all this. Actually the disk activity will depend on the specific applications (database? mail server? machines compiler?), but the above is true for boots, and whenever applications are idle. You should see the profile to know.

    RAID 10 is faster (and often more reliable) than RAID 5 or RAID-6 except in certain specific cases. In General RAID 10 is ideal for many random writes, since the calculation of parity for RAID-5 and - 6 adds to the overall latency between command and response - latency is cumulative if a little slow here and a little slow it adds up to a lot of overall slow synchronous especially with e/s on a network. OTOH RAID-5 and -6 can produce faster readings due to the number of heads, so you can use it for virtual machines that transfer bulk. Test. You may find that you need several different types subdashboards for best results.

    You said 3ware, they have some good grades on their site, but don't believe it. With my 9650 that I found myself with only a couple of their recommendations-, I put the (simple) table for allocation size 256 k, nr_requests at 2 x the queue_depth and use the planner date limit. I had the habit for the Ext4 file system formatted with stride and stripe-width synced to the table and used the options large_files with fewer inodes (do not use the huge_files option unless you plan to have single VMDK files in the terabyte range). Use a cache of great reading in advance.

    Virtual machines use VMDK files in all cases except raw iSCSI LUN that they treat native disks. VMDK is easier to manage - you can make a backup by copying the file, you can move it to a PC and load it into another flavour of VMware, etc. There could be some features iSCSI to your San as a transparent migration but nothing for me. NFS has less chatter of Protocol if latency lower times to complete an operation. NFS is good to read and write a block of data, that's all it boils down to.

    UPS is good, but it won't help if something inside the machine explodes (UPS does nothing if the PC power supply goes down). If the RAID card has an option for a battery backup module, so it can contain some writings in memory and may end up the disk i/o after replacing the power supply. 3ware also limits the types of caching available if help is not installed, and you get just the right numbers with the module.

  • What is the best way to backup of virtual machines on a standalone ESX with the data store local

    Hello

    I want to save the virtual machines on a host ESX autonomous. and all of these virtual machines is the local data store.  What is the best way to save these virtual machines in this situation?

    And probably we don't provision VTL on the local data center, so it is possible to use VCB to backup? And VCB is a good choice compared to the traditional method that installs the backup client in each virtual machine?   Because I think that in this situation with the data store local, it cannot not reduced the load on ESX hosts and network overhead can be avoided.

    Thank you!

    LAN

    > 1. VCB usable remote tape library? I mean it's not local library and uses the tape library to another network data center.

    VCB is completely unrelated to the tape library, it is a framework, not a backup solution. If your standard backup software can work with the remote tape library you can try it to ungrateful with VCB.

    > 2. what the difference bwteen hot - added NBD and modes if there is that an ESX host with store data local and want to use a virtual machine like VCB proxy? I think that they are the same: the VCB proxy read data through the I/O of the ESX host stack in this situation.

    NBD works on network and the backup traffic goes through the service console connection. Hot add uses special machine for assistance to connect vmdk to and uses of e/s disk stack instead of e/s network.

    > 3. Veeam Backup is free software?

    No, it isn't.

    ---

    MCSA, MCTS, VCP, VMware vExpert 2009

    http://blog.vadmin.ru

  • Different VM 1 with 3 vmdk in the data store: Migration of data to rename store

    Hello

    I'm here today to ask for your help please.

    In our Organization, we have 1 large VM

    1 vmdk = > The BONES in lun, SAS performance

    1 vmdka = > 1 Tera SATA MON only of DATA

    Another 1 vmdka = > 1 Tera SATA MON only of DATA

    This virtual machine is being tested and we need to rename it to the name of the production.

    When you rename in vcenter you do a data store migration to correct all files with the new name.

    In this case, how can we specify each VMDK to go to the data store specified during migration?

    Because we could all think in the same data store due to the limitation of 2Tera by a data store

    Thanks for your help

    When you "migrate" a virtual machine and choose 'Change Datastore' use the advanced option. This will allow you to specify multiple destinations of data store. Use the drop-down arrow in the current [location].

  • Problems with the data store when installting ESXi USB

    I had problems getting free ESXi reliable running.  I am able to install a flash drive fine and initially everything works and I am able to create virtual machines.  Upon the first connection to vSphere, told me that there is no data store, so I create one on my controller LSI 400 GB RAID1 8308elp without problem.  However, once I reboot the server ESXi I lose the data store.  When I check my warehouses under Configuration it is listed.  At this point, if I try to create the data store, yet once I get "Error during the configuration of the host".  I read about using fdisk from the console when people have had this problem but there is no access console in the free version.  Is that what I can do to work around this problem?

    Right in the HCL... SAS/SATA-RAID of the lists for older versions, SCSI for the current version... Search within i/o devices for "LSI 8308elp '...

    VMware VCP4

    Review the allocation of points for "useful" or "right" answers.

  • Request for help with the output of a script

    Hello

    I need assistance with the output of a script. I have a script that retrieves advanced config of the esx hosts in a cluster and exports to a txt file. Here is the script I use:

    $Decimals = 1

    $VCServers = @)

    $VMSummaries = @)

    $InputFile = "VCs.txt".

    1. Read the input file, loop of VCs

    Foreach ($VCname in Get-Content $InputFile) {$VCServers += $VCName}

    Foreach ($VCServer to $VCServers)

    {

    $VC = to connect-VIServer $VCServer

    $VMhosts = get-VMHost

    Foreach ($VMHost to $VMhosts)

    {

    Write-Progress "Collecting information in $VCServer" 'connecting to host $VMHost' - Id 0

    $VMSummary = "" | Select the host name, TCPIPHeapMax, TCPIPHeapSize, HeartbeatTimeout, HeartbeatFrequency, HeartbeatMaxFailures, MaxVolumes

    $VMSummary.HostName = $VMHost.Name

    $VMSummary.TCPIPHeapMax = (get-VMHostAdvancedConfiguration - VMHost ($VMhost) - name Net.TcpipHeapMax). Values

    $VMSummary.TCPIPHeapSize = (get-VMHostAdvancedConfiguration - VMHost ($VMhost) - name Net.TcpipHeapSize). Values

    $VMSummary.HeartbeatTimeout = (get-VMHostAdvancedConfiguration - VMHost ($VMhost) - name of NFS. HeartbeatTimeout). Values

    $VMSummary.HeartbeatFrequency = (get-VMHostAdvancedConfiguration - VMHost ($VMhost) - name of NFS. HeartbeatFrequency). Values

    $VMSummary.HeartbeatMaxFailures = (get-VMHostAdvancedConfiguration - VMHost ($VMhost) - name of NFS. HeartbeatMaxFailures). Values

    $VMSummary.MaxVolumes = (get-VMHostAdvancedConfiguration - VMHost ($VMhost) - name of NFS. MaxVolumes). Values

    $VMSummaries += $VMSummary

    }

    }

    $OutputFile = "AdvancedNFS.txt".

    $VMSummaries | Format-Table | Out-file $OutputFile

    This script runs without any problem and generates a text file that looks like this:

    TCPIPHeapMax TCPIPHeapSize HeartbeatTimeout HeartbeatFrequency HeartbeatMaxFailures MaxVolumes hostname

    -


    -


    -


    -


    -


    -


    -


    abcd1 abcd2 abcd3

    I am trying to output a csv file and run into a problem where each host values are not displayed correctly. I replaced the last 2 lines in the script as follows:

    $OutputFile = "AdvancedNFS.csv".

    $VMSummaries | Export-CSV $OutputFile

    My output looks like this:

    Host name

    TCPIPHeapMax

    TCPIPHeapSize

    HeartbeatTimeout

    HeartbeatFrequency

    HeartbeatMaxFailures

    MaxVolumes

    ABCD1

    System.Collections.Hashtable + ValueCollection

    System.Collections.Hashtable + ValueCollection

    System.Collections.Hashtable + ValueCollection

    System.Collections.Hashtable + ValueCollection

    System.Collections.Hashtable + ValueCollection

    System.Collections.Hashtable + ValueCollection

    What I am doing wrong?

    Thank you

    Alex

    Hello

    You can try changing your script like this:

    • -Replace "." "With values '-["'-']. "

    • -Optimize calls to Get-VMHostAdvancedConfiguration

    Your code will look like this:

    ...

    Write-Progress "Collecting information in $VCServer" 'connecting to host $VMHost' - Id 0

    $VMSummary = "" | Select the host name, TCPIPHeapMax, TCPIPHeapSize, HeartbeatTimeout, HeartbeatFrequency, HeartbeatMaxFailures, MaxVolumes

    $VMSummary.HostName = $VMHost.Name

    $VMHostAdvancedConfig = get-VMHostAdvancedConfiguration - VMHost $VMHost - name Net.TcpipHeapMax, Net.TcpipHeapSize, NFS. HeartbeatTimeout, NFS. HeartbeatFrequency, NFS. HeartbeatMaxFailures, NFS. MaxVolumes

    [$VMSummary.TCPIPHeapMax = $VMHostAdvancedConfig\["Net.TcpipHeapMax"\]

    [$VMSummary.TCPIPHeapSize = $VMHostAdvancedConfig\["Net.TcpipHeapSize"\]

    $VMSummary.HeartbeatTimeout = $VMHostAdvancedConfig\ ['NFS. HeartbeatTimeout '\] '.

    $VMSummary.HeartbeatFrequency = $VMHostAdvancedConfig\ ['NFS. HeartbeatFrequency '\] '.

    $VMSummary.HeartbeatMaxFailures = $VMHostAdvancedConfig\ ['NFS. HeartbeatMaxFailures '\] '.

    $VMSummary.MaxVolumes = $VMHostAdvancedConfig\ ['NFS. MaxVolumes '\] '.

    $VMSummaries += $VMSummary

    ...

    Kind regards

    Dimitar

  • How to move a rule definition with the data store for esx alarm without re-creating the rule?

    Hi, I would spend my rule of definition of alarm of the data at the level of esx store, without re-creating the rule. Is this possible?

    In the Act, I don't want no definition of the alarm at the data store level. So, what is the best practice?



    Best regards

    It is currently not possible.  The rules are hierarchical, and there is no way to stop the inheritance, or move messages.  You will have to re-create them at the appropriate level.

    -KjB

    VMware vExpert

  • Need help with the date of Validation Urgent

    Hello

    We need help in the Validation Date.

    We have 2 fields of Date on the form the Start Date, End Date

    The requirement is: End Date (cannot be more than 30 years as of the start date).

    I wrote after the script on the exit eventof the End Date . But the problem is its calculation of 30 years from the current Date not from the Start Date

    var

    tDate = util.scand (' mm/dd/yyyy', new Date());

    var

    M = tDate.getMonth ();

    var

    D = tDate.getDate ();

    var

    Y = tDate.getFullYear ();

    var

    SRes = util.printd("yyyy-mm-dd", new Date((Y+30), M,D) );

    App.Alert (SRes)

    If

    (SRes < = this.rawValue)

    {

    App.Alert ("cannot be greater than 30 years from the start date")

    () xfa.host.setFocus

    ce );

    }

    can someone help me please

    Kind regards

    Jay

    Hello

    You need to get the LCD field javascript and calculate & compare with the future date in date javascript.

    Try the following script.

    var sDate = StartDate.rawValue;
    var wkStartDate = util.scand ("yyyy-mm-dd", sDate);

    nYear var = wkStartDate.getFullYear ();
    nMonth var = wkStartDate.getMonth ();
    nJour var = wkStartDate.getDate ();

    var wkFutureDate = new Date (+ 30 nYear, nMonth, nJour);

    sDate = EndDate.rawValue;
    var wkEndDate = util.scand ("yyyy-mm-dd", sDate);

    If (wkEndDate.getTime () > wkFutureDate.getTime ()) {}
    xfa.host.messageBox ("cannot be more than 30 years from the start date");
    xfa.host.setFocus (this);
    }

  • Hi, I need help with the dates of the plugins added to my browser

    Hi I need to know when a plugin has been installed on my browser.

    openh264 / video codec provided by cisco systems.

    If you can't help, please point me in the direction of someone who can?
    

    Any help much appreciated.

    Hello, this particular plugin has been installed with the update for firefox 33.
    http://andreasgal.com/2014/10/14/openh264-now-in-Firefox/

  • What is the 'Live' page and need help with the data merge

    Hello

    Im very new to indesign naked with me. Im trying to merge data (need to create a fusion template?) and what I understand is that I need to be on the page 'Live '. Someone on the forum suggested this...

    There are two ways to set up the model of fusion. You can put your placholders on the master page or on the live page. If the placehlders are on the master page, only the frame (s) with placeholders, as well as other grouped objects, will be duplicated. On the live page, ID will try to duplictate EVERYTHING on the page, so you must be very careful about installation and sizing of objects.

    I want to be on the LIVE page... How can I do this? Got any other sort but can't get several records for the life of me to come.

    Thank you for your help adavance

    It is the opposite of multiple records per page. Make x copies of a single record on a page, put x sets of organized placeholders as you want on the page. A good way to do it is with Edit > step and repeat after you set up the left superior set. Now merge as one record per page.

  • Need help with the date

    Hi all

    I have a requirement where my table contains the values key1, Key2, and timestamp (example 24 January 2013 06:45:45)

    Now I have several values for the same key1, key2, and date with different stamps. I need to keep records only 2 with less output and max timestamp for key1 and key2.

    Can you please indicate how this can be done?

    Like this

    SQL > create table k (key1, key2 whole integer, date of ts);

    Table created.

    SQL > insert into k
    2. Select 1, 1, trunc (sysdate) + numtodsinterval (level, 'time')
    3 double
    4. connect by level<=>

    10 rows created.

    SQL > alter session set nls_date_format = 'DD-MON-YYYY HH24:MI:SS ";

    Modified session.

    SQL > select * from k;

    CLE1 KEY2 TS
    ---------- ---------- --------------------
    1 1 31 JANUARY 2014 01:00
    1 1 31 JANUARY 2014 02:00
    1 1 31 JANUARY 2014 03:00
    1 1 31 JANUARY 2014 04:00
    1 1 31 JANUARY 2014 05:00
    1 1 31 JANUARY 2014 06:00
    1 1 31 JANUARY 2014 07:00
    1 1 31 JANUARY 2014 08:00
    1 1 31 JANUARY 2014 09:00
    1 1 31 JANUARY 2014 10:00

    10 selected lines.

    SQL > select key1
    2, key2
    3, ts
    4 of)
    5. Select k.*
    6, min (ts) over (partition by key1, key2, trunc (ts)) min_ts
    7, max (ts) over (partition by key1, key2, trunc (ts)) max_ts
    8 k
    9         )
    10 where ts = ts or min_ts = max_ts;

    CLE1 KEY2 TS
    ---------- ---------- --------------------
    1 1 31 JANUARY 2014 01:00
    1 1 31 JANUARY 2014 10:00

    SQL >

  • I need help with the date

    Hi all
    CREATE TABLE INV
    (INV_DATE DATE ,
     QTY      NUMBER)
    Insert into INV (INV_DATE,QTY) values (to_date('01/01/13','DD/MM/RR'),2);
    Insert into INV (INV_DATE,QTY) values (to_date('02/01/13','DD/MM/RR'),1);
    Insert into INV (INV_DATE,QTY) values (to_date('01/02/13','DD/MM/RR'),5);
    Insert into INV (INV_DATE,QTY) values (to_date('10/02/13','DD/MM/RR'),6);
    Insert into INV (INV_DATE,QTY) values (to_date('03/03/13','DD/MM/RR'),1);
    Insert into INV (INV_DATE,QTY) values (to_date('04/03/13','DD/MM/RR'),77);
    I need result like this (I have total amount per month)
    inv_date     qty
    1                3
    2                11
    3                78

    Analytical use.
    John post in a hurry lol

    select
     to_number(TO_CHAR (inv_date, 'MM')) inv_date,
    sum(QTY)
    from INV
    group by
    to_number(TO_CHAR (inv_date, 'MM')) 
    
  • Migration of virtual machines from a data store, and then delete the data store?

    Hello

    I have a future deployment this month and my Director wants to build a new RAID 6 array, create a store of data with the new table and then move all the VMS to the newly created data store.

    Then he asked me to take the old data store and remove it and the available space between the deleted data store and other stores of data in our shared environment. The question is when the new raid is created and vm has migrated to the new data store, which is the best way to remove the data store empty and make sure that the space available for other data stores? Any help would be appreciated...

    Greg ~.

    If all controls are met, you can go ahead and take it apart without any problem.

    I have re-iterate below checks:

    -No virtual machine is in the data store

    -The data store is not part of the cluster data store

    -The data store is not managed by the DRS storage

    -IGCS is disabled for this data store

    -The data store is not used for vSphere HA heartbeat.

    Especially highlighted 2 controls. Please note that SIOC can be enabled on the data without SDR photo store

  • Help with the Powershell script to collect logs from all domain controllers

    I am writing a script to retrieve the last 5 days of application, security and log files from all domain controllers. The script runs, but fire the logs from the local server only. The variable $Computer has all of my DC so it's the fine mark. I guess it's a problem with my line ForEach-Object, but is not error. See the below script.

    $log = 'application '.
    $date = get-date-format MM-DD-YYYY
    $now = get-date
    $subtractDays = new-object System.TimeSpan 5,0,0,0,0
    $then = $Now.Subtract ($subtractDays)
    $Computers = get-ADDomainController-filter *.
    ForEach-Object - InputObject $Computers - process {Get-EventLog - LogName $log - after $then - before $now - EntryType error | select EventID, MachineName, Message, Source, TimeGenerated |} ConvertTo-html | {Out-file $env:TEMP\Applicationlog.htm}
    Invoke-Expression $env:TEMP\Applicationlog.htm

    Thank you

    Rich

    Hello

    To help with the repost the question script to the script Center Forum

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

  • What happens with the data on ROW as soon as they are storage migrated to VMDK?

    Hi all

    The following scenario: I have a virtual machine with virtual RDM. I have storage migration online, selection of thick discs so convert the VMDK RDM. The question is: what is actually happening with the data on the LUN that was RDMs, once the migration is complete?

    I expect that the data are still there, and if needed, I can remove the VMDK and re - attach the new LUNS as RDM.. But I can't find any official information on this.

    I am not mistaken? Y at - there somewhere that says clearly what is happening with the data?

    Thank you!

    Your wait is quite correct. The data on the raw LUN will not get affected once it is converted to a virtual machine. Only the mapping of RDM file is deleted and the LUN becomes available, and you can use card or again as an RDM or to create a VMFS data on that store.

    André

Maybe you are looking for