Shutdown VM On Logoff
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Shutdown VM On Logoff
Host: Windows 7 Ultimate x64
Guests: Windows 7 Ultimate x64
I am using VirtualBox on my development machine. I currently start and stop the VMs I need manually. I would like a clean way to automatically shutdown any VM that is running when I logoff.
I have tried a logoff script with VBoxManage but it runs too late in the logoff process. Windows sends VirtualBox a close command before running the logoff script and VirtualBox then stops with the do you want to save, etc. dialogbox.
Guests: Windows 7 Ultimate x64
I am using VirtualBox on my development machine. I currently start and stop the VMs I need manually. I would like a clean way to automatically shutdown any VM that is running when I logoff.
I have tried a logoff script with VBoxManage but it runs too late in the logoff process. Windows sends VirtualBox a close command before running the logoff script and VirtualBox then stops with the do you want to save, etc. dialogbox.
-
jorgensen
- Posts: 589
- Joined: 20. Oct 2009, 01:22
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows
Re: Shutdown VM On Logoff
An alternative is to use Close->Save the Machine State which is very fast and do what you request.
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
That is what I am currently doing. I need a way of doing it automatically when my userid is logged off.jorgensen wrote:An alternative is to use Close->Save the Machine State which is very fast and do what you request.
Re: Shutdown VM On Logoff
Build a delay in the logoff script, or ping test until that fails, then logoff.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
The logoff script is run by the system as part of the logoff process. As I stated in my first post the problem is that the system runs the logoff script after it signals all running processes to end. IOW, the timing line is:vbox4me2 wrote:Build a delay in the logoff script, or ping test until that fails, then logoff.
1. Logoff process begins -- triggered by either a manual logoff request or by the Windows OS as part of a shutdown process.
2. Windows signals all tasks running under the user to close.
3. VitualBox gets the close signal and hangs waiting for the user to respond to its request for the type of close to do.
4. The OS then runs the logoff script.
Please note that the logoff script I am talking about is one that is define through a group policy option that a script that I run to logoff the macine. The former is run automatically (but too late in the process) -- the later has to be run manually and is not what I need.
Re: Shutdown VM On Logoff
Yes I know, I use the same system at logoff or shutdown, but the same policy also has values about 'run at the same time', you have to set these accordingly and it will work as you want.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
I think you are refering to:vbox4me2 wrote:Yes I know, I use the same system at logoff or shutdown, but the same policy also has values about 'run at the same time', you have to set these accordingly and it will work as you want.
Run logoff scripts synchronously
Enable this option to run logoff scripts before the user logs off.
However, as noted at: http://technet.microsoft.com/en-us/libr ... S.10).aspx
This is appears to only be available in the group policy editor on a server. I am running on a standalone workstation that is not connected to a domain. The policy does not appear when running the local group policy editor gpedit.msc.
Is there a registry hack to implement this policy on a standalone workstation?
Re: Shutdown VM On Logoff
There are more policies on disk then mmc initially shows, I can't see at the moment which one I used but its there by default and works.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
I opened a blank MMC console and added the Group Policy Object which open the Select Group Policy Object dialog box. The only GPO choices were Local Computer and individual users. Neither had the Run Logoff Scripts Synchronously policy.vbox4me2 wrote:There are more policies on disk then mmc initially shows, I can't see at the moment which one I used but its there by default and works.
If you remember how you got to it please post the information here.
Re: Shutdown VM On Logoff
http://forums.techarena.in/software-dev ... 287253.htm
http://74.125.77.132/search?q=cache:biu ... clnk&gl=nl
http://74.125.77.132/search?q=cache:biu ... clnk&gl=nl
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
Both of the above discuss running a script at shutdown and not how to enable Logoff Scripts Synchronously on a standalone workstation. I have the script in the correct folder and it runs at logoff but too late. The question is how to enable Logoff Scripts Synchronously on a standalone workstation?
Re: Shutdown VM On Logoff
Then it has to be some policy setting as it works at shutdown and logoff just as the articles describes. You might have set values that should not be set.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
The only policy I set was to define a script to be run a logoff. The normal operation for a standalone workstation that has a logoff script set is for the script to be run toward the end of the logoff process after running tasks have been told to close. This is what is happening on my workstation -- per the description for running a logoff script. Unfortunately, that is too late in the logoff process to use VBoxManage to shutdown VMs running under VirtualBox -- VirtualBox has already been told to close and hangs waiting for a response from the user.vbox4me2 wrote:Then it has to be some policy setting as it works at shutdown and logoff just as the articles describes. You might have set values that should not be set.
You said your logoff script runs early enough to shutdown a VM running under VirtualBox. As near as I can tell that requires enabling the "Run logoff scripts synchronously"policy. The question is did you enable that policy without being part of a domain -- that is on a standalone workstation? If you did how did you do it?
Re: Shutdown VM On Logoff
Yes but you can reverse that policy setting, there are 2 settings which influence each other and a reboot is required when changing them, I'd have to look later on again to see what exactly is broadcasted as a policy. The Host is not a domain member. I might have used a logoff shortcut to a script or changed the classid pointing logoff to elsewhere.
[This space is intentionally left blank]
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
If you can read this, you can read the VirtualBox Manual, the Forum FAQ, and the QuickClick FAQ
-=[ Search this forum with Keywords, VirtualBox solutions at you're fingertips]=-
-
saberman
- Posts: 293
- Joined: 21. Dec 2009, 00:32
- Primary OS: MS Windows 10
- VBox Version: VirtualBox+Oracle ExtPack
- Guest OSses: Windows XP, 7, 8.1, 10
Re: Shutdown VM On Logoff
Would this cover the case where the logoff was initiated by the system not the user?vbox4me2 wrote:I might have used a logoff shortcut to a script or changed the classid pointing logoff to elsewhere.