简体   繁体   English

来自其他计算机的 Windows 服务器中的任务计划

[英]Task schedule in windows server from other computer

I am scheduling a task from vb.net with these parameters.我正在使用这些参数从 vb.net 安排任务。 Generates the task correctly and executes it.正确生成任务并执行它。 This works correctly in local, but I need that task to be created on the server.这在本地工作正常,但我需要在服务器上创建该任务。 Any ideas?有任何想法吗?

Using tService As New TaskService()
    Dim Fecha As DateTime = DateTime.Parse(txtFDesde.Text + " " + txtHDesde.Text)
    Dim tTime As New TimeTrigger()
    Dim tDefinition As TaskDefinition = tService.NewTask
    tDefinition.RegistrationInfo.Description = "Tarea programada para ejecutar"
    tDefinition.Settings.RunOnlyIfLoggedOn = False
    tTime.StartBoundary = New DateTime(Fecha.Year, Fecha.Month, Fecha.Day, Fecha.Hour, Fecha.Minute, 0)
    tDefinition.Triggers.Add(tTime)
    Dim url As String = "http://localhost:5000/" & Param
    tDefinition.Actions.Add(New ExecAction("cmd.exe", "/c start " & url))
    tService.RootFolder.RegisterTaskDefinition("Test " & Param, tDefinition)
End Using

尝试静态连接方法......你需要服务器的凭据...... https://msdn.microsoft.com/en-us/library/windows/desktop/aa383451(v=vs.85).aspx

This is working, I just have to add the server paramters on "Connect()"这是有效的,我只需要在“Connect()”上添加服务器参数

Const TriggerTypeTime = 1
Const ActionTypeExec = 0

Dim service = CreateObject("Schedule.Service")
Call service.Connect()

Dim rootFolder
rootFolder = service.GetFolder("\")

Dim taskDefinition
taskDefinition = service.NewTask(0)

Dim regInfo
regInfo = taskDefinition.RegistrationInfo
regInfo.Description = "Testing"
regInfo.Author = "Me"

Dim principal
principal = taskDefinition.Principal

' revisar
principal.LogonType = 3

Dim settings
settings = taskDefinition.Settings
settings.Enabled = True
settings.StartWhenAvailable = True
settings.Hidden = False

Dim triggers
triggers = taskDefinition.Triggers

Dim trigger
trigger = triggers.Create(TriggerTypeTime)

Dim startTime
startTime = L_TraducirParaTrigger(Fecha)

trigger.StartBoundary = startTime
trigger.Id = "TimeTriggerId"
trigger.Enabled = True

Dim Action
Action = taskDefinition.Actions.Create(ActionTypeExec)
Action.Path = "C:\Windows\System32\cmd.exe"
Dim url As String = "http://localhost:5000/" & L_IdEjecucion
Action.Arguments = "/c start " & url
'revisar último parámetro
 Call rootFolder.RegisterTaskDefinition(L_Id, taskDefinition, 6, , , 3)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 VB应用程序连接到我的计算机上的服务器正常,但未连接到任何其他计算机 - VB Application connects to server fine on my computer but not on any other computer 在局域网上的其他计算机上查找SQL Server实例 - Find SQL Server Instance on other computer on LAN FolderBrowseDialog从客户端计算机浏览服务器计算机的文件夹 - FolderBrowseDialog to browse folder of server computer from client computer 如何从UNC以外的其他计算机访问图像文件? - How to access image file from other computer other than UNC? 除了我的(主机)以外,没有在其他计算机上获取SQL Server Express数据 - Not getting SQL Server Express data on other computer except in mine (host) 如何从另一台计算机连接Mysql服务器? - How to connect Mysql server from another computer? 在Windows重新启动或关闭时如何触发偶数任务或计划任务,并强制Windows等待某些操作完成 - How to trigger even or schedule task when windows is restarting or shutting down, and force windows to wait until some actions to be done 出于测试目的,通过服务器计算机上的 IP 连接到我的 SQL 服务器是否与其他计算机不同? - Is connecting to my SQL server by IP on the server computer different to other computers for testing purposes? 直接从.exe进行控制台应用程序执行与通过任务计划执行之间的区别? - Differences in execution of console application directly from .exe vs executed via task schedule? 从其他网络上的计算机连接到MS SQL Server 2014 - Connect to MS SQL Server 2014 from a computer on a different network
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM