CreateScheduledTask on Vmware ESX

Posted on 2:50 PM by Bharathvn

ManagedObjectReference MgdObjRef_VM =
_service.FindByInventoryPath(_sic.SearchIndex(), pathVM);
MethodActionArgument[] mActArgumnt = new MethodActionArgument();
MethodAction mAction = new MethodAction();
mActArgumnt.Value = MgdObjRef_VM;
ma.Argument = mActArgumnt;
ma.Name = "MigrateVM";
DailyTaskScheduler dtScheduler = new DailyTaskScheduler();
dtScheduler.Hour = 12;
dtScheduler.Minute = 0;
ScheduledTaskSpec tSpec = new ScheduledTaskSpec();
tSpec.Action = mAction;
tSpec.Scheduler = dtScheduler;
tSpec.Enabled = true;
tSpec.Name = "Migrate virtual machine";
tSpec.Description = "Migrate virtual machine at noon");
tSpec.Notification = "VMAdmin@syngress.com";
_service.createScheduledTask(_sic.ScheduledTaskManager,MgdObjRef_VM,tSpec);