Welcome to Twocanoes Knowledge Base

The Twocanoes forum is the best place to find information about Winclone, Boot Runner, or any other software. Post a question or share information about Twocanoes Software products. We will attempt to answer any unanswered questions within 2-3 business days. If you need an answer more quickly, consider upgrading to Pro Support for 1 business day response time. Winclone can be upgraded to Winclone Pro right in the app.

If you have Winclone Pro, submit a request on the Pro Support page.

Our knowledge base has moved.

Follow

Automate VM Log Out

Boot Runner 2 supports auto-login to launch virtual machine operating systems automatically.  When users log out, shutdown or suspend a virtual machine, it will not log the user out of the OS X account automatically.  Boot Runner 2 contains hooks that will help automate the logout of a virtual machine from the host OS X account and return to the Boot Runner Selection Screen.  

The basic setup involves setting a Windows logout script to generate a particular file whenever the user logs out, shuts down or suspends the virtual machine. Boot Runner sees the file and runs a script to immediately log out of the OS X host account.

Depending on how the virtual host is configured you may need to create a share that can be read from and written to by both Windows and OS X.  This share will contain a file that, when created, triggers the OS X account logout.  

The file created by the Windows logout script is located at /Users/Shared/.com.twocanoes.bootrunnerlogout or defined by “LogoutFile" preference key.  Boot Runner sees the file and runs a OS X script located at /Library/Application Support/Twocanoes/Boot Runner/logoutscript or path defined by “VMPostrunScript” preference key. You may modify the Boot Runner logout script to include other actions.

By default the logout script at /Library/Application Support/Twocanoes/Boot Runner/logoutscript simply logs out the user:

osascript -e 'tell application "loginwindow" to «event aevtrlgo»'

[Note: see this project for a customizable Logout On Idle app]

In Windows, create a batch file that generates a file in /Users/Shared/.com.twocanoes.bootrunnerlogout file (please note the "." at the beginning of the file name which make this file invisible and less likely to be inadvertently deleted or tampered with by users).  

There are multiple ways to generate a file in Windows.  In this example, the batch file script creates the file .com.twocanoes.bootrunnerlogout by inserting the text "deleteme" into the file stored in a shared location between OS X and Windows (the "deleteme" text is not required, just included for illustration).  The share is represented by a volume named psf.  The syntax is: 

echo deleteme > \\psf\shared\.com.twocanoes.bootrunner.logout

Place the batch file in C:\Users\Public\Documents.  To set this batch script to run whenever logging out of Windows, go to Run-> gpedit.msc and select Windows Settings-> Scripts-> Logoff

 

Click Add and browse to the batch file, select and it will appear in the scripts window.

Now, when a user logs off of the Windows virtual machine, the file .com.twocanoes.bootrunnerlogout will be created in the shared location.  Boot Runner will detect the existence of the file and run a script to log out of the host OS X account, placing the user back at the Boot Runner Selection Screen. For cleanup, Boot Runner deletes the file .com.twocanoes.bootrunnerlogout.  

Note: 

If you touch a file at "/Users/Shared/.com.twocanoes.bootrunnerlogout” you will be logged out. You can configure the file using the key LogoutFile but you must also change the value in the launch agent:
 
Terminal: cat /Library/LaunchAgents/com.twocanoes.bootlauncher.plist 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.twocanoes.bootlauncher</string>
<key>ProgramArguments</key>
<array>
<string>/Library/PrivilegedHelperTools/Boot Runner.app/Contents/Resources/bootlauncher</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>WatchPaths</key>
<array>
<string>/Users/Shared/.com.twocanoes.bootrunnerlogout</string>
</array>
</dict>
</plist>
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk