간단히 말해서 내 응용 프로그램은 대상에 대한 UNC 연결이 불가능한 원격 대상으로 파일을 복사해야합니다. 그러나 UNC 연결 대상에서 및 BACK 서버에서 항상 가능합니다. 그래서 계획은 WMI를 사용하여 원격 명령 셸 (cmd)을 시작하고 copy 명령을 사용하여 파일을 가져 오는 것입니다. 그러나 이것은 효과가 없습니다. 타겟의 명령 줄에서 수동으로 실행될 때 다음 명령은 잘 작동 :파일을 복사하는 WMI 원격 프로세스
copy \\192.168.100.12\c$\remotefile.txt c:\localfile.txt
하지만이 InputParameters("CommandLine")
의 일환으로이 같은 명령을 할 때 작동하지 않습니다, 어떤 오류가 발생하지 않습니다.
Dim ConnectionOptions As New System.Management.ConnectionOptions
With ConnectionOptions
.Username = "target\Administrator"
.Password = "password"
End With
Dim ManagementScope As New System.Management.ManagementScope("\\192.168.100.11\root\cimv2", ConnectionOptions)
Try
ManagementScope.Connect()
MsgBox("connected")
Dim ManagementPath As New System.Management.ManagementPath("Win32_Process")
Dim ManagementOptions As New System.Management.ObjectGetOptions
Dim ManagementClass As New System.Management.ManagementClass(ManagementScope, ManagementPath, ManagementOptions)
Dim InputParameters As System.Management.ManagementBaseObject = ManagementClass.GetMethodParameters("Create")
InputParameters("CommandLine") = "cmd /c copy \\192.168.100.12\c$\remotefile.txt c:\localfile.txt"
Dim OutputParameters As System.Management.ManagementBaseObject = ManagementClass.InvokeMethod("Create", InputParameters, Nothing)
MsgBox("done")
Catch ex As Exception
MsgBox(ex.Message)
End Try
어떤 아이디어 왜 ISN : 나는 여기에 calc.exe 등을 시작으로 나는 대상 및 원격 실행에 연결하는 WMI를 사용하여 잘 작동 할 수 있습니다 작동하지 않는 코드 일하는거야? 아니면 누구든지 내가하려는 일을하는 더 나은 방법이 있습니까?