I'd like to automate the below steps using Excel VBA/VB Script. Here is the list of actions I do manually
Step1: login to winscp.
- Hostname: example.ash.pwj.com
- Port: 22
- UsrName: xxx Pwd: yyyy
- File Protocol: SFTP
transfer a file named 'testFile' from local machine to a Directory in Unix server using Winscp (the directory has a python script 'connector.py')
Step2: Open putty.
- Destination Host Name: example.ash.pwj.com
- Port: 22
- Connection Type: SSH
- Login using credentials.
Step3: call python script in the directory.
python connector.py argument1 argument2 argument3
Example: python connector.py testFile example2.ash.pwj.com 123
I have to handle WINSCP file transfer and calling python script in putty using Excel VBA/VBScript.
Here is my code:
Set sh = CreateObject("WScript.Shell")
sh.Run "pscp -pw yyyy C:\Users\abc\testFile xxx@example.ash.pwj.com:/home/test/dir", 0, True
sh.Run "plink.exe -pw yyyy xxx@example.ash.pwj.com python /home/test/dir/connector.py testFile example2.ash.pwj.com 514", 0, True