Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

v0.0.4

  • Loading branch information...
commit f3e4fffd88bc5eef0f7cdb5cdcc2b6bc1a4c8f76 1 parent 7a3b2a7
Azer Koculu authored
Showing with 14 additions and 3 deletions.
  1. +7 −0 README.md
  2. +3 −1 lib/virtualbox.js
  3. +1 −1  package.json
  4. +3 −1 test/exec.js
View
7 README.md
@@ -31,6 +31,13 @@ virtualbox.start("Win32", function(error){
});
```
+### Executing commands as Administrators
+Pass username and password information within options;
+
+```javascript
+virtualbox.exec({ vm: "ie8", "user":"Administrator", "password": 123456" ...
+```
+
# Available Methods
* start
View
4 lib/virtualbox.js
@@ -53,6 +53,8 @@ function stop(vmname, callback){
function vmExec(options, callback){
var vm = options.vm || options.name || options.vmname || options.title,
+ username = options.user || options.username || 'Guest',
+ password = options.pass || options.passwd || options.password,
path = options.path || options.cmd || options.command || options.exec || options.execute || options.run,
params = options.params || options.parameters || options.args;
@@ -62,7 +64,7 @@ function vmExec(options, callback){
path = path.replace(/\\/g, '\\\\');
- var cmd = 'guestcontrol '+vm+' execute --image "cmd.exe" --username Guest -- "/c" "'+path+'" "'+params+'"';
+ var cmd = 'guestcontrol '+vm+' execute --image "cmd.exe" --username ' + username + ( password ? ' --password ' + password : '' ) + ' -- "/c" "'+path+'" "'+params+'"';
logging.info('Executing command "vboxmanage %s" on VM "%s"', cmd, vm);
View
2  package.json
@@ -1,6 +1,6 @@
{
"name":"virtualbox",
- "version":"0.0.3",
+ "version":"0.0.4",
"description":"A library to interact with VirtualBox.",
"author":"Azer Koculu <azer@kodfabrik.com>",
"keywords":["virtualbox","vboxmanage"],
View
4 test/exec.js
@@ -1,12 +1,14 @@
var virtualbox = require('../lib/virtualbox'),
args = process.argv.slice(2),
vm = args[0],
+ user = args[1],
+ pass = args[2],
path = "C:\\Program Files\\Internet Explorer\\iexplore.exe";
virtualbox.start(vm, function(){
- virtualbox.exec({ 'vm': vm, 'path': path, 'params': [args[1] || 'google.com'] }, function(error){
+ virtualbox.exec({ 'vm': vm, 'user': user, 'passwd': pass, 'path': path, 'params': [args[1] || 'google.com'] }, function(error){
if(error) throw error;
});
Please sign in to comment.
Something went wrong with that request. Please try again.