mstsc远程桌面问题

时间:2012-06-11 15:23:36

标签: vbscript rdp mstsc

目前,为了改善日常流程的一些低效率,我正在尝试编写一个ac#Winform应用程序,它将用户输入和VBscripts的组合结合起来,这将加速以前所有用户输入查看excel文件的过程并将文件从VSS移动到某些服务器的某些文件夹。

我希望得到一些问题,以正确的方式指出:

使用命令行或其他解决方法而不是手动,

1)是否可以使用智能卡/引脚登录2003远程桌面?

2)是否可以通过机器上的命令在远程桌面上运行文件/启动进程?

感谢您的帮助和时间

1 个答案:

答案 0 :(得分:1)

我只有第二个问题的经验。 您可以使用远程脚本或使用SysInternals PsExec http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx等实用程序执行此操作 这里有一个远程启动ipconfig命令并将其重定向到文本文件的vbscript 请注意,您无法启动此类交互式流程,它们会启动但不会显示

Dim sComputer   'computer name
Dim sCmdLine    'command line of the process
Dim sCurDir   'working directory of the process
Dim oProcess    'object representing the Win32_Process class
Dim oMethod   'object representing the Create method
sComputer = "." 'this is the local computer, use a pcname or ip-adress to do it remote
sCmdLine = "cmd /c ipconfig.exe > c:\ipconfig.txt"
Set oProcess    = GetObject("winmgmts://" & sComputer & "/root/cimv2:Win32_Process")
Set oMethod     = oProcess.Methods_("Create")
Set oInPar    = oMethod.inParameters.SpawnInstance_()
oInPar.CommandLine  = sCmdLine
oInPar.CurrentDirectory = sCurDir
Set oOutPar     = oProcess.ExecMethod_("Create", oInPar)
If oOutPar.ReturnValue  = 0 Then
  WScript.Echo "Create process method completed successfully"
  WScript.Echo "New Process ID is " & oOutPar.ProcessId
Else
  WScript.Echo "Create process method failed"
End If
相关问题