Install Packages to run script from cygwin on virtual box

Hi All,


Today we are going to talk about, packages required to run shell script or any script on virtual via cygwin

If we want to create new VM in virtual box we can provision via Oracle Virtual box UI, also can create via virtual box shell scripting, assume you prepared with virtual box script (if want to know how prepare virtual box script will post in next blog)

There are few packages required to run script

  • expect, openssh, and procps 

Lets see how to install expect and openssh/ssh, procps

Installation of Cygwin, expect and Ssh
1. Download cygwin from
2. Run set up.exe file and select install from internet option
3. Select desired root directory and Local package directory
4. Select your Internet connection as Direct connection
5. From the Download site Choose Available Download site
6. Select packages expect, openssh, and procps  to install
7. For installing expect, procps select  > TCL
8. For installing ssh search by package name openssh and select > Net
9. Click install
10. Once it is installed just enter expect command on prompt which should
display expect1.1


Automating login to headend using expect tool installed in Cygwin
1. Create a file namely sshlogin.exp and give execute permissions
2. Update the file with the given code snippet


set timeout 20

set ip [lindex $argv 0]

set user [lindex $argv 1]

set password [lindex $argv 2]

spawn ssh “$user\@$ip”

expect “Password:”

send “$password\r”;

send “cd /export/home/dncsop/Automation_Resources/\n”

send “ls\n”


exit 0

3.Execute the script as ./sshlogin.exp ipaddress username passwd
e.g : ./sshlogin.exp root password


Now the packages are installed, to run virtual box script (Desktop/Virtualbox/

Open Cygwin and run

cd /cygdrive/c/Users/{name}/Desktop/virtualbox


Now the Procps packages will check the free space like RAM/Disk utility as mentioned in virtual box script and will spin VM instances inside oracle virtual box.


Thanks for reading !!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s