Open GQsj opened 7 years ago
To upload a file (e.g. a .ps1
file), there isn't a handy method in winrm4j yet. However, there is some example code to do it at https://github.com/cloudsoft/winrm4j/blob/0.5.0/winrm4j/src/test/java/io/cloudsoft/winrm4j/winrm/AbstractWinRmToolLiveTest.java#L228-L247
You could use code like that, and then execute a simple script that just executes your .ps1
script.
I have found the method of using cmd and PScmd, such as executeCommand(...) in the WinRMTool file, that can be used to send the local command to the remote server and return the result. But I don't find the method to send the local script file such as .ps1 file to the remote server and execute it, is there any method in this project to operate the local PS script(.ps1) file? Or any other method I can operate the local script to execute in the remote server? I'll be very appreciate if anyone can give me some advice.