2012-06-11 41 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