Firstly i cant run the VBoxManage commands as administrator that easly as it gives me this error because it see's me as the nt authority\system user and not <domain>\administrator.
I created a Batch file like this :
Code: Select all
:: Check if a VBox is active
@echo OFF
Cls
Set defaultserver="ETSIC-BASE"
::IF dummy==dummy%1 (
::echo run : runme.bat [servername]
echo useing default server %defaultserver%
set vboxname=%defaultserver%
::) ELSE (
:: set vboxname=%1
::)
whoami
VBoxManage showvminfo %vboxname%"
::SANUR
::runas /u:etsic1\administrator "whoami > bat_file_output.log" | sanur password && echo/Succeeded || echo/Failed
::LSRUNAS
::lsrunas /user:administrator /password:password /domain:etsic /command:notepad.exe /runpath:c:\
:: runs on box when logged in as admin but not from the website.
:: VBoxManage showvminfo %vboxname%
:: Run as Admin but prompts for password.
:: runas /noprofile /env /user:password1\administrator "VBoxManage showvminfo %vboxname%"
:: http://www.joeware.net/freetools/tools/cpau/usage.htm
:: run as admin program loaded.
:: CPAU doesn't support running from LocalSystem.
:: cpau -u password1\administrator -p password -ex VBoxManage showvminfo %vboxname%
TIMEOUT 5
Code: Select all
VirtualBox Command Line Management Interface Version 1.5.6
(C) 2005-2008 innotek GmbH
All rights reserved.
[!] Failed to create the VirtualBox object!
[!] Primary RC = E_FAIL (0x80004005) - Unspecified error
[!] Full error info present: true , basic error info present: true
[!] Result Code = E_FAIL (0x80004005) - Unspecified error
[!] Text = Could not lock the settings file 'C:\Documents and Settings\Default User\.VirtualBox\VirtualBox.xml' (VERR_SHARING_VIOLATION)
[!] Component = VirtualBox, Interface: IVirtualBox, {76b25f3c-15d4-4785-a9d3-adc6a462beec}
[!] Callee = <NULL>, {00000000-0000-0000-0000-000000000000}
You will see that ive tried runas, lsrunas and sanur and none seam to be helping me out. So please please any help on this issue would be cool.
here is a test execute script you can use with php:
Code: Select all
<?php
/* BAT File save in C:\htdocs\runas.bat
save log file C:\htdocs\bat_file_output.log
-----------------
whoami
VBoxManage showvminfo %vboxname%"
-----------------
*/
$run=5;
if ($run == 1){
$commandTest = 'lsrunas /user:administrator /password:password /domain:etsic1 /command:C:\Apache\Apache2.2\htdocs\aum2\ajax\runas.bat > bat_file_output.log /runpath:C:\Apache\Apache2.2\htdocs\aum2\ajax\ ';
}elseif($run == 2){
$commandTest = 'runas /u:etsic1\administrator "C:\Apache\Apache2.2\htdocs\aum2\ajax\runas.bat > bat_file_output.log" | sanur password && echo/Succeeded || echo/Failed ';
}elseif($run == 3){
$commandTest = 'lsrunas /user:administrator /password:password /domain:etsic1 /command:whoami > bat_file_output.log /runpath:C:\Apache\Apache2.2\htdocs\aum2\ajax\ ';
}elseif($run == 4){
$commandTest = 'runas /u:etsic1\administrator "whoami > bat_file_output.log" | sanur password && echo/Succeeded || echo/Failed ';
}else{
$commandTest = 'runas.bat > bat_file_output.log';
}
$result = exec_batfile($commandTest);
echo "<hr /><pre>";
echo $result;
echo "</pre>";
function exec_batfile($command){
echo $command;
exec($command);
$handle = fopen("C:\Apache\Apache2.2\htdocs\aum2\ajax\bat_file_output.log", "r");
if ($handle) {
$buffer = '';
while (!feof($handle)) {
$buffer .= fgets($handle, 4096);
}
fclose($handle);
}
return $buffer;
}
?>