Move VM to csv file and create the scheduled task in VC

What is the problem with the last line ' $scheduledTaskManager.CreateScheduledTask ($vmView.MoRef, $task) "?

  1. The ScheduledTaskManager lies in the Service Instance.

$si = get-view ServiceInstance

$scheduledTaskManager is Get-view $si. Content.ScheduledTaskManager

  1. We need to identify the virtual machine and the host where it will be powered on.

#$vmView = get - VM PowerOnTest | Get-View

#$esxView = get-VMHost esx35 - 01.vitoolkit.local | Get-View

foreach ($f in (import-csv '

'D:\MigrateStorage\amsterdam-core-hp-poweron.csv'))

{

$vmView = $f

*

echo $vmView

*

}

  1. Now we build the task argument.

$arg = New-Object VMware.Vim.MethodActionArgument

#$ARG value = $esxview. MoRef

$action = New-Object VMware.Vim.MethodAction

$action. Argument = $arg

$action. Name = "PowerOnVM_Task".

$scheduler = new-object VMware.Vim.OnceTaskScheduler

$scheduler.runat = .addminutes (5) (get-date)

$task = New-Object VMware.Vim.ScheduledTaskSpec

$task. Action = $action

$task. Description = 'start a virtual machine with a scheduled task '.

$task. Enabled = $true

$task. Name = 'Virtual Machine market '.

$task. Programmer = $scheduler

$scheduledTaskManager.CreateScheduledTask ($vmView.MoRef, $task)

The following script should do the trick.

$csvName = 
$tgtDatastore = 
$emailAddr = 
$startTime =                   # Ex [Datetime]"10/21/2009 20:00"
$startInterval = 

$si = get-view ServiceInstance
$scheduledTaskManager = Get-View $si.Content.ScheduledTaskManager

$offset = 0
Import-Csv $csvName | % {
     $vm = Get-View -ViewType VirtualMachine -Filter @{"Name"=$_.VMname}

     $spec = New-Object VMware.Vim.ScheduledTaskSpec
     $spec.Name = "svMotion " + $_.VMname
     $spec.Description = "Migrate " + $_.VMname + " to " + $tgtDatastore
     $spec.Enabled = $true
     $spec.Notification = $emailAddr
     $spec.Scheduler = New-Object VMware.Vim.OnceTaskScheduler
     $spec.Scheduler.runat = $startTime.AddMinutes($offset)
     $offset += $startInterval
     $spec.Action = New-Object VMware.Vim.MethodAction
     $spec.Action.Name = "RelocateVM_Task"

     $arg1 = New-Object VMware.Vim.MethodActionArgument
     $arg1.Value = New-Object VMware.Vim.VirtualMachineRelocateSpec
     $arg1.Value.datastore = (Get-Datastore $tgtDatastore | Get-View).MoRef
      $arg1.Value.pool = $vm.ResourcePool
      $arg1.Value.host = $vm.Runtime.Host

     $spec.Action.Argument += $arg1
     $arg2 = New-Object VMware.Vim.MethodActionArgument
     $arg2.Value = [http://VMware.Vim.VirtualMachineMovePriority|http://VMware.Vim.VirtualMachineMovePriority]"defaultPriority"
     $spec.Action.Argument += $arg2

     $scheduledTaskManager.CreateScheduledTask($vm.MoRef, $spec)
}

Although the scheduled task will trigger a svMotion, CreateScheduledTask method seems still need a host and resourepool MoRef in VirtualMachineRelocateSpec argument.

Tags: VMware

Similar Questions

  • Unable to create restore point. Vista64. Could not create the scheduled task for the following reason: cannot create a file when that file already exists

    RAID 5 obtained corrupte had to rebuild after that can't create system restore point. Tried everything sfc, fsutil, Dungeon SystemPropertiesProtection screen displaying this error: "could not create the scheduled task for the following reason: cannot create a file when that file already exists." (0x800700B7)"system of work in all other respects. SFC says it found and fixed errors every time I run it.

    Fix tried Della Li: Please remove the WindowsBackup folder in the HKEY_LOCAL_MACHINE NT\CurrentVersion\Schedule\TaskCache\Tree\Microsoft\Windows.

    Delete the WINDOWS BACKUP folder. Unfortunately this folder does not exist.

    Checked VSS, Taskscheduler and other services are runnig

    Tried to boot from the CD and widowed revover. Says no problems. The error to any manulation of the checkbox in the properties of the system, the system protection screen

    Solved

    It turns out that task scheduler got corrupted it have several tasks Scheduler said were not available, but are still in the working directory. These tasks especially SR from compensation directory solved the problem and I can now create backup points.

  • Trying to enable and disable the scheduled tasks back but becomes "the name of the specified task * does not exist in the system.

    I am trying to create a .bat file that stops a set of scheduled tasks and start another game, but when it works it is said that there is no such thing as the name of the task

    SCHTASKS/Change/disable /TN ImageCopyTest
    ERROR: The name of the specified job 'ImageCopyTest' does not exist in the system.

    Running schtasks/query does not list the tasks that I have implemented in Task Scheduler

    For operational reasons, the tasks are set on "Run If the user is logged in or not ' and I read somewhere that this automatically makes the hidden task

    Can someone shed light on how I can get around what I need this operation for our recovery after disaster

    It's on Windows Server 2008 R2 Enterprise

    Hello

    Apologize for the delay in response. Because the question you posted is related to Windows Server and more complex than that which are usually dealt with here, this issue will be safer in our MSDN forums that cater to the more THIS professional audience.

    Thank you.

  • How to create the scheduled task oracle

    DECLARE
    jobno NUMBER;
    BEGIN
    SYS. DBMS_JOB. Send
    (work = > jobno)
    , this = > 'DEL_HIST_TABLE ';
    , next_date = > to_date (September 4, 2009 18:23 ',' dd/mm/yyyy hh24:mi:ss')
    , interval = > 'null '.
    , no_parse = > TRUE
    );
    SYS. DBMS_OUTPUT. Put_line (' job number is: ' | to_char (jobno));
    END;
    commit;


    I wrote the above work to operate on specific date and time

    but I want to convert the same to run

    everyday @ 01:00 using oracle 10 g

    Published by: [email protected] on May 17, 2009 23:39

    Hello

    You must set the interval then:

    MHO%xe> select trunc(sysdate) + 1/24 + 1 from dual;
    
    TRUNC(SYSDATE)+1/24
    -------------------
    19-05-2009 01:00:00
    
    1 rij is geselecteerd.
    
    MHO%xe> DECLARE
      2  jobno NUMBER;
      3  BEGIN
      4  SYS.DBMS_JOB.SUBMIT
      5  ( job => jobno
      6  ,what => 'begin null; end;'
      7  ,next_date => to_date('09/04/2009 18:23:00','dd/mm/yyyy hh24:mi:ss')
      8  ,interval => 'trunc(sysdate) + 1/24 + 1'
      9  ,no_parse => TRUE
     10  );
     11  SYS.DBMS_OUTPUT.PUT_LINE('Job Number is: ' || to_char(jobno));
     12  END;
     13  /
    Job Number is: 21
    
    PL/SQL-procedure is geslaagd.
    
    Verstreken: 00:00:11.39
    MHO%xe> commit;
    
    Commit is voltooid.
    MHO%xe> select interval from user_jobs where job = 21;
    
    INTERVAL
    ----------------------------------------------------------
    trunc(sysdate) + 1/24 + 1
    
    1 rij is geselecteerd.
    

    Published by: hoek on May 18, 2009 08:49 added to example

  • Read xls file and display the data in the table.

    Hello

    Try to read the data from an xls or csv file and fill the same data in the table. If I need to use the table to store the data from the file and display, hoping that someone could help.

    Thank you

    Hari

    Hi hari,.

    One thing that is very important when you use the Excel activeX interface (in case you need it) is good termination of worksheet/workbook/lettering handles.

    You need these handles to specify what cell in which file you are trying to access.

    If you are unable to throw each handle you have, then you will be left with ghost Excel process in your task manager, devours your system's memory.

    Thus, when debugging of your application, open the Task Manager and the watch as Excel treats created/destroyed and make sure that you end up with zero Excel process running when your application is closed.

    Also consider the case of fault for your program. Check that your exit routes did not omit any termination of handle.

  • Load a CSV file and access to variables

    Hi guys,.

    I am new to AS3 and treated with AS2 before (just to get the scope when change it).

    Is it possible in AS3 to load an excel .csv file into Flash using the URLLoader (or?) and the data in the form of variables?

    I can get the .csv to load and trace values (cell1, cell2, cell3...) but I do not know how to collect the data and place it into variables.

    Can I create a table and access like so... MonTableau [0], myArray [1]? If so, I don't know why it does not work.

    I have to be on the road quite wrong. Here's what I have so far...

    var loader: URLLoader = new URLLoader();
    loader.dataFormat = pouvez;
    loader.addEventListener (Event.COMPLETE, dataLoaded);

    var request: URLRequest = new URLRequest ("population.csv");
    Loader.Load (request);
    //...
    function dataLoaded(evt:Event):void {}
    var myData:Array = new Array (loader.data);
    trace (mydata [i]);

    }

    Thanks for any help,

    Sky

    Simply load your csv file and use the string flash methods to allocate these values in a table:

    var myDate:Array = loader.data.split(",");

  • When I import my .wav and my .m2V files still accepts the .wav file but does not load the .m2V file.  I created movie DVD 5 discs - still accepted the .wav and for the four remaining groups .m2V files and created 4 DVD discs for

    When I import my .wav and my .m2V files still accepts the .wav file but does not load the .m2V file. I created movie DVD 5 discs - still accepted the .wav and for the four remaining groups .m2V files and created 4 DVD discs for these files. What can I do to be free from this error?

    OSstatus = error-37

    Note that this a Mac operating system error.

    http://forums.CreativeCOW.NET/thread/145/865447

    Error when importing the file: slash or other character in file name

    http://forums.Adobe.com/message/3729601

    The build error: slash or other character in file name

    http://forums.CreativeCOW.NET/thread/145/868994

    The build error: complete startup disk

  • ODI - read CSV file and write to the Oracle table

    Hello world

    After 4 years, I started to work again with ODI, and I'm completely lost.

    I need help, I don't know what to use for each step, interfaces, variables, procedures...

    What I have to do is the following:

    (1) reading a CSV file-> I have the topologies and the model defined

    (2) assess whether there is a field of this CSV file in TABLE A-> who do not exist in the table is ignored (I tried with an interface joining the csv with the TABLE model a model and recording the result in a temporary data store)

    Evaluate 3) I need to update TABLE C and if not I need to INSERT if another field that CSV exists in TABLE B-> if there

    Could someone help me with what use?

    Thanks in advance

    Hi how are you?

    You must:

    Create an interface with the CSV template in the source and a RDBM table in the target (I'll assume you are using Oracle). Any type of filter or the transformation must be defined to be run in the stadium. (you must use a LKM for SQL file and add an IKM Sql control (it is best to trim them and insert the data when it cames to a file if you want after this process, you may have an incremental update to maintain history or something like that).)

    For validation, you will use a reference constraints in the model of the oracle table: (for this you need a CKM Oracle to check constraints)

    Then, you must select the table that you sponsor and in the column, you choose which column you will match.

    To article 3, you repeat the above process.

    And that's all. Pretty easy. If you do not have the two tables that you need to use your validation that you need to load before loading the CSV file you need valid.

    Hope this can help you

  • Create a csv file and send it in an e-mail message

    In coldfusion, is it possible to create a csv file and send it in an e-mail, without ever save this file on the hard drive?

    Lol you can't attach a file to an e-mail, unless the file has been created.

    We deal with this situation by creating the file in a directory designated for dynamically created files.  Then we have a scheduled task that cleans all files over a certain age, every night.

  • Is there a way to select an area of some of the elements of a csv file and read in LabVIEW?

    Hello everyone, I was wondering if there was a way to select only a certain "box" of the elements of a .csv file in LabVIEW? I have LabVIEW 2011 and my main goal is to take two tables and graphs against each other. I can import the .csv perfectly and separate each line and each column to be his own, but I have a 8 X 8 but want graphic in the middle of 4 X 5 or something like that. Is it possible to extract a table without starting at the beginning and end in the end? Thank you in advance.

    Hi Szklanam,

    as a CSV file is a TXT file with a different suffix, you can read a number of lines in this file. For example, you can limit the number of rows in your table of resultung. To limit the number of columns, you must always use an ArraySubset, so maybe it is much easier to read the complete CSV file and select interesting places with ArraySubset...

  • How to move the MSWMM files and keep the data on my computer?

    I downloaded digital film from my camera to a destination on my D drive as a file MSWMM (collections), and whenever I try to move the downloaded film (collection), it does not recognize the movie more.

    How to move the MSWMM files and keep the data on my computer?

    The mswmm file is the project file, not a video.
    Think of it as a recipe for a cake, it only tells you what to do with the ingredients, but does not include the ingredients.
    The mswmm file tells the computer to look in a certain folder to use a video or audio file.
    If you move the file, then MM knows not where is the file, then you must tell it, by right clicking on a red x on the timeline and then choose search for the file.

  • Sorry, unable to save your movie. Find missing files or delete the unusable items in your project and then try again. "Error: 0 x 87160129" during video editing in Windows Movie Maker/Windows Live Movie Maker

    I use the same device which was used to make movies in the past with no problems. The error message is sorry, unable to save your movie. Find missing files or delete the unusable items in your project and then try again. Error: 0 x 87160129

    I've never had any problems with this before and made more than 100 movies using WLMM or WMM. Thanks for any help. Would that my camera settings? I use a Lumix.

    I just found out what the problem is freakin ' and the solution. If the inserted videos have different "video codec" then it will not work!

    Before adding videos to Movie Maker, throw in a video converter and convert them all. (Even if the original format is WMV, convert again to WMV) that will ensure the output videos have the same codec!
    This solved the problem for me, hope, it does for you too...
  • I made pdf file and added the audio file as a file embedded using acrobat pro 8, it works fine on pc (windows) when I move tab (android) the pdf file open but sound did not work. what I have to do to make it work

    I made pdf file and added the audio file as a file embedded using acrobat pro 8, it works fine on pc (windows) when I move to tab (android) the pdf file open but sound did not work. what I have to do to make it work

    Adobe Acrobat for Android or iOS software currently play any sound or video.

    -Dov

  • Trying to download music from itunes on a Windows Movie Maker 6.0 file and receive an error msg stating not installed codec. Windows Vista operating system.

    Trying to download music from itunes on a Windows Movie Maker 6.0 file and receive an error msg stating not installed codec.  Windows Vista operating system.

    Trying to download music from itunes on a Windows Movie Maker 6.0 file and receive an error msg stating not installed codec.  Windows Vista operating system.

    ==============================
    The following thread explains how to convert
    the files to a different format... iTunes then
    You should be able to import them.

    Need help to convert itunes to Windows Media
    http://social.answers.Microsoft.com/forums/en-us/vistamedia/thread/f496ae8e-d3f9-4336-BB3C-8070421c8eff
    (Scroll to the bottom to detach the message by: musiclover101)

    Or... use the following freeware to convert your
    already downloaded files to the .wma format.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    Format Factory
    http://www.pcfreetime.com/
    (FWIW... installation..., you can uncheck
    all the boxes on the last screen)

    After downloading and installing Format Factory...
    Open the program and choose an output folder...
    (this is where you will find your files when they are
    converted)

    Drag and drop your files in iTunes on the main screen...

    Select "while"WMA"/ OK...

    Click on... Beginning... in the toolbar...

    That should do it...

    Good luck...

    John Inzer - MS - MVP - Digital Media Experience - Notice_This is not tech support_I'm volunteer - Solutions that work for me may not work for you - * proceed at your own risk *.

  • Reading file and dump the data into the database using BPEL process

    I have to read the CSV file and insert data into the database... To do this, I created some asynchronous bpel process. Adapter filed added and associated with the receive activity... Adapter DB has added and associated with the Invoke activity. Receive two total activity are available in the process when trying to Test em, receive only the first activity is complete and awaits the second receive activity. Please suggest how to proceed with...

    Thanks, Maury.

    Hi Maury,

    There is no need in step 2 that u mentioned above. I donot find useless a webservice?

    The process will be launched by the CSV file, then using the processing activity, you can put it in the DB.

    There should be no way where you can manually test it by giving an entry. All you can do to test is to put the file in the folder you mentioned when configuring the file adapter.

    You just need to have the composite as below:

    ReadCSVFile---> BPEL--> DB adapter

    And in your BPEL process:

    Recieve--> Transformation activity--> call activity

    Try to work on some samples listed on the oracle site and go through the below URL:

    The playback of the file adapter feature using

    Thank you

    Deepak.

Maybe you are looking for

  • How to print selected reading list items?

    I have 12.5.1 on iOS 10.12. I have a playlist of 4 CD album (72 Articles) I want to print on the CD Jewel case chosen model elements. Problem: 'print' does not recognize the selection and print all of the items in the list.

  • iwatch memory

    I think I have the sports room sport/race version. Does anyone know the ability of memory of music because there is no detail anywhere on the line? Thank you

  • Satellite A200-1CR changed Vista to Windows XP edition SP2 family - function key does not work

    Dear Sir my system is SatelliteA200-1CR.I was changed from vista to Windows XP SP2 home edition, but * _function don't touch working_ * donot is change properties.Please can someone help to me? I'll wait for your replay.Thank you for your information

  • I have a screen 725 is aspire broken please tell me cost of the screen?

    Hello Sir/Madam Aspire one 725 I have this computer Mini laptop iam going to the service center, they told me this screen is broken and you have paid rs 6000 for new screen I do not understand this because the cost of this product is 19000 if the scr

  • Scanner - one or more ActiveX controls can be displayed

    Software HP Precision Scan Pro for the ScanJet 4400C worked fine on my Windows XP Pro SP3 computer, but now it shows that when I open it to analyze: Then, when I press one of the buttons on the left side and blue window, all white on: I did no change