2012-06-11 151 views
0

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

,我希望能得到一些回答的问题,指出了正确的方式:

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

1)是否有可能登录到2003的远程桌面智能卡/ pin?

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

感谢您的帮助和时间

回答

1

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

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 
+0

谢谢!看着这个,但不知道公司是否会批准它。将很快尝试。任何我应该知道的许可证? –

+1

psexec是我知道的免费软件,但是m $接受了它,所以请检查以确定是否重要 – peter