문제

currently, to improve some inefficiencies on a daily process, I am trying to write a c# Winform app that will combine a mix of user-input with VBscripts that will expedite a previously all user-input process of looking at an excel file and moving files from VSS to certain folders of certain servers.

I was hoping to get some questions answered, pointed in the right way:

Using command line or other workaround instead of manually,

1) Is it possible to log into a 2003 remote desktop with a Smartcard/pin?

2) Is it possible to run a file/start a process on the remote desktop from a command on your machine?

Thanks for the help and time

도움이 되었습니까?

해결책

I have only experience with the second question. You can do this with remote scripting or with utilities like SysInternals PsExec http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx here a vbscript that remotely starts a ipconfig command and redirects it to a textfile Note that you can't start interactive processes like this, they would start but not show 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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top