How to change power status of Windows host from Ubuntu guest OS?How to access Mysql installed in windows host...
Efficiently merge handle parallel feature branches in SFDX
The plural of 'stomach"
Is a roofing delivery truck likely to crack my driveway slab?
Is expanding the research of a group into machine learning as a PhD student risky?
Is there a problem with hiding "forgot password" until it's needed?
Is there any reason not to eat food that's been dropped on the surface of the moon?
Increase performance creating Mandelbrot set in python
Why is delta-v is the most useful quantity for planning space travel?
Where in the Bible does the greeting ("Dominus Vobiscum") used at Mass come from?
Is it okay / does it make sense for another player to join a running game of Munchkin?
Was Spock the First Vulcan in Starfleet?
Applicability of Single Responsibility Principle
Print name if parameter passed to function
Tiptoe or tiphoof? Adjusting words to better fit fantasy races
How to verify if g is a generator for p?
Teaching indefinite integrals that require special-casing
Products and sum of cubes in Fibonacci
Will it be accepted, if there is no ''Main Character" stereotype?
Why Were Madagascar and New Zealand Discovered So Late?
Curses work by shouting - How to avoid collateral damage?
What's the purpose of "true" in bash "if sudo true; then"
Time travel short story where a man arrives in the late 19th century in a time machine and then sends the machine back into the past
Student evaluations of teaching assistants
Are there any comparative studies done between Ashtavakra Gita and Buddhim?
How to change power status of Windows host from Ubuntu guest OS?
How to access Mysql installed in windows host from ubuntu guest?Unable to ping host from guestWith VMware Workstation, how can I SSH from the host to a guest with NAT?VMware 10 and Linux guest OS: how to change NIC driver from vmxnet3 to vmxnetCopy & paste from linux guest to windows host failsHow to share internet connection from vmware OSX guest to Windows host?VMware: How to Reset a Hung GuestHow to access VMWare guest OS file system from host?How do I use 2 VLANs on 1 Guest OS (Windows 7) over Host OS (Windows 7)How to share folders between host and guest in VMware?
I have an Ubuntu14.04 guest in VMWare Workstation 12 on Windows 7 host.
How can I change the power status of the host,e.g. power down or sleep,from the guest OS?
vmware-workstation
New contributor
add a comment |
I have an Ubuntu14.04 guest in VMWare Workstation 12 on Windows 7 host.
How can I change the power status of the host,e.g. power down or sleep,from the guest OS?
vmware-workstation
New contributor
add a comment |
I have an Ubuntu14.04 guest in VMWare Workstation 12 on Windows 7 host.
How can I change the power status of the host,e.g. power down or sleep,from the guest OS?
vmware-workstation
New contributor
I have an Ubuntu14.04 guest in VMWare Workstation 12 on Windows 7 host.
How can I change the power status of the host,e.g. power down or sleep,from the guest OS?
vmware-workstation
vmware-workstation
New contributor
New contributor
New contributor
asked 7 mins ago
jw_jw_
1
1
New contributor
New contributor
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Currently my way is use the share folder,in the guest OS:
echo "">/mnt/hgfs/share/sleep
Then on the host write a program to monitor whether the file "sleep" exist and execute sleep action.
For power down,the program monitor vmware-vmx.exe,when it disappears,it shutdown the computer.
The C# program is like:
class ShutdownComputer
{
//true for sleep,false for shutdown
static bool sleep = true;
static public void ShutdownComputerDo()
{
string[] process_names = new string[]
{
"vmware-vmx",
};
while (true)
{
bool done = true;
string sleep_signal_fn = @"C:VMachineVM_Ubuntu14.04sharesleep";
if (sleep)
{
done = File.Exists(sleep_signal_fn);
if (done) File.Delete(sleep_signal_fn);
}
else
{
foreach (string pn in process_names)
{
if (Process.GetProcessesByName(pn).Length > 0) done = false;
}
}
if (done)
{
var psi=sleep?
new ProcessStartInfo("rundll32.exe", " powrprof.dll,SetSuspendState 0,1,0")
: new ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
if (!sleep) break;
}
Thread.Sleep(5 * 1000);
}
}
}
Although it works,are there any easier ways?
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
jw_ is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1417980%2fhow-to-change-power-status-of-windows-host-from-ubuntu-guest-os%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Currently my way is use the share folder,in the guest OS:
echo "">/mnt/hgfs/share/sleep
Then on the host write a program to monitor whether the file "sleep" exist and execute sleep action.
For power down,the program monitor vmware-vmx.exe,when it disappears,it shutdown the computer.
The C# program is like:
class ShutdownComputer
{
//true for sleep,false for shutdown
static bool sleep = true;
static public void ShutdownComputerDo()
{
string[] process_names = new string[]
{
"vmware-vmx",
};
while (true)
{
bool done = true;
string sleep_signal_fn = @"C:VMachineVM_Ubuntu14.04sharesleep";
if (sleep)
{
done = File.Exists(sleep_signal_fn);
if (done) File.Delete(sleep_signal_fn);
}
else
{
foreach (string pn in process_names)
{
if (Process.GetProcessesByName(pn).Length > 0) done = false;
}
}
if (done)
{
var psi=sleep?
new ProcessStartInfo("rundll32.exe", " powrprof.dll,SetSuspendState 0,1,0")
: new ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
if (!sleep) break;
}
Thread.Sleep(5 * 1000);
}
}
}
Although it works,are there any easier ways?
New contributor
add a comment |
Currently my way is use the share folder,in the guest OS:
echo "">/mnt/hgfs/share/sleep
Then on the host write a program to monitor whether the file "sleep" exist and execute sleep action.
For power down,the program monitor vmware-vmx.exe,when it disappears,it shutdown the computer.
The C# program is like:
class ShutdownComputer
{
//true for sleep,false for shutdown
static bool sleep = true;
static public void ShutdownComputerDo()
{
string[] process_names = new string[]
{
"vmware-vmx",
};
while (true)
{
bool done = true;
string sleep_signal_fn = @"C:VMachineVM_Ubuntu14.04sharesleep";
if (sleep)
{
done = File.Exists(sleep_signal_fn);
if (done) File.Delete(sleep_signal_fn);
}
else
{
foreach (string pn in process_names)
{
if (Process.GetProcessesByName(pn).Length > 0) done = false;
}
}
if (done)
{
var psi=sleep?
new ProcessStartInfo("rundll32.exe", " powrprof.dll,SetSuspendState 0,1,0")
: new ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
if (!sleep) break;
}
Thread.Sleep(5 * 1000);
}
}
}
Although it works,are there any easier ways?
New contributor
add a comment |
Currently my way is use the share folder,in the guest OS:
echo "">/mnt/hgfs/share/sleep
Then on the host write a program to monitor whether the file "sleep" exist and execute sleep action.
For power down,the program monitor vmware-vmx.exe,when it disappears,it shutdown the computer.
The C# program is like:
class ShutdownComputer
{
//true for sleep,false for shutdown
static bool sleep = true;
static public void ShutdownComputerDo()
{
string[] process_names = new string[]
{
"vmware-vmx",
};
while (true)
{
bool done = true;
string sleep_signal_fn = @"C:VMachineVM_Ubuntu14.04sharesleep";
if (sleep)
{
done = File.Exists(sleep_signal_fn);
if (done) File.Delete(sleep_signal_fn);
}
else
{
foreach (string pn in process_names)
{
if (Process.GetProcessesByName(pn).Length > 0) done = false;
}
}
if (done)
{
var psi=sleep?
new ProcessStartInfo("rundll32.exe", " powrprof.dll,SetSuspendState 0,1,0")
: new ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
if (!sleep) break;
}
Thread.Sleep(5 * 1000);
}
}
}
Although it works,are there any easier ways?
New contributor
Currently my way is use the share folder,in the guest OS:
echo "">/mnt/hgfs/share/sleep
Then on the host write a program to monitor whether the file "sleep" exist and execute sleep action.
For power down,the program monitor vmware-vmx.exe,when it disappears,it shutdown the computer.
The C# program is like:
class ShutdownComputer
{
//true for sleep,false for shutdown
static bool sleep = true;
static public void ShutdownComputerDo()
{
string[] process_names = new string[]
{
"vmware-vmx",
};
while (true)
{
bool done = true;
string sleep_signal_fn = @"C:VMachineVM_Ubuntu14.04sharesleep";
if (sleep)
{
done = File.Exists(sleep_signal_fn);
if (done) File.Delete(sleep_signal_fn);
}
else
{
foreach (string pn in process_names)
{
if (Process.GetProcessesByName(pn).Length > 0) done = false;
}
}
if (done)
{
var psi=sleep?
new ProcessStartInfo("rundll32.exe", " powrprof.dll,SetSuspendState 0,1,0")
: new ProcessStartInfo("shutdown", "/s /t 0");
psi.CreateNoWindow = true;
psi.UseShellExecute = false;
Process.Start(psi);
if (!sleep) break;
}
Thread.Sleep(5 * 1000);
}
}
}
Although it works,are there any easier ways?
New contributor
New contributor
answered 5 mins ago
jw_jw_
1
1
New contributor
New contributor
add a comment |
add a comment |
jw_ is a new contributor. Be nice, and check out our Code of Conduct.
jw_ is a new contributor. Be nice, and check out our Code of Conduct.
jw_ is a new contributor. Be nice, and check out our Code of Conduct.
jw_ is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Super User!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1417980%2fhow-to-change-power-status-of-windows-host-from-ubuntu-guest-os%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown