def test_SchRpcStopInstance(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS) dce2, rpctransport = self.connect(self.stringBindingAtSvc, atsvc.MSRPC_UUID_ATSVC) atInfo = AT_INFO() atInfo['JobTime'] = NULL atInfo['DaysOfMonth'] = 0 atInfo['DaysOfWeek'] = 0 atInfo['Flags'] = 0 atInfo[ 'Command'] = '%%COMSPEC%% /C vssadmin > %%SYSTEMROOT%%\\Temp\\ANI 2>&1\x00' try: resp = atsvc.hNetrJobAdd(dce2, NULL, atInfo) resp.dump() except Exception as e: if e.get_error_code() != ERROR_NOT_SUPPORTED: raise else: # OpNum not supported, aborting test return jobId = resp['pJobId'] try: resp = tsch.hSchRpcRun(dce, '\\At%d\x00' % jobId, ('arg0', 'arg1')) resp.dump() except Exception as e: print(e) pass request = tsch.SchRpcStopInstance() request['guid'] = resp['pGuid'] request['flags'] = 0 try: resp = dce.request(request) resp.dump() except Exception as e: if str(e).find('SCHED_E_TASK_NOT_RUNNING') <= 0: raise pass resp = atsvc.hNetrJobDel(dce2, NULL, jobId, jobId) resp.dump()
except Exception as e: if e.get_error_code() != ERROR_NOT_SUPPORTED: raise else: # OpNum not supported, aborting test return jobId = resp['pJobId'] try: resp = tsch.hSchRpcRun(dce, '\\At%d\x00' % jobId, ('arg0','arg1')) resp.dump() except Exception, e: print e pass request = tsch.SchRpcStopInstance() request['guid'] = resp['pGuid'] request['flags'] = 0 try: resp = dce.request(request) resp.dump() except Exception, e: if str(e).find('SCHED_E_TASK_NOT_RUNNING') <= 0: raise pass resp = atsvc.hNetrJobDel(dce2, NULL, jobId, jobId) resp.dump() def test_hSchRpcStopInstance(self): dce, rpctransport = self.connect(self.stringBindingAtSvc, tsch.MSRPC_UUID_TSCHS)