Math31 Posted November 8, 2018 Share Posted November 8, 2018 (edited) Hello. I have a system which consists of Main PC and Virtual Box installed on it with different virtual Windows OS versions (win7 x32, win7 x64, win10 x64, etc.) The idea to have an AutoIt script running on Virtual Machine which will create file with some text on Shared Folder of Virtual Box. And, in fact the following simple solution works well for me with virtual Windows 7 versions: Report_File() Func Report_File() Local $name = @UserName Local $VMSharePointPath = "E:\" $sFileName = ($VMSharePointPath & "Response\" & $name & ".txt") $hFilehandle = FileOpen($sFileName, $FO_OVERWRITE) FileWrite($hFilehandle, "Started" & @CRLF) FileClose($sFileName) EndFunc The issue occurs only with Virtual Machine Windows 10 - it does not create any file on Shared Drive of Virtual Box, regardless that I can manually do it. In fact E:\ drive is mapped and I can manually create/edit files there from virtual machine, but it is not possible via AutoIt code execution. I already tried multiple solutions: 1. User Account Control settings on VM are at Never Notify level. 2. #RequireAdmin 3. #pragma compile(ExecLevel, requireAdministrator) 4. Advanced Sharing Settings on VM are set to File and Printer Sharing. But it does not help only with Windows 10 x64 version. Settings of Shared Folder in Virtual Box are the same for all Virtual Machines (Auto-mount - Yes, Access - Full) As I mentioned there is no issue at all with Windows 7 Virtual Machines and in manual approach. Problem occurs only with AutoIt execution on Windows 10 Virtual Machine. Any ideas where could be source of the problem and how to solve it? Thank you in advance for any tip. Edited November 13, 2018 by Math31 Link to comment Share on other sites More sharing options...
Skeletor Posted November 8, 2018 Share Posted November 8, 2018 (edited) Hi, Welcome to AutoIt. Please use the <> to insert your code. First click on edit to edit your post, cut your code out from your comment and click on the the <> to paste it in. Then click on the Save button at the bottom. Thank you! Edited November 8, 2018 by Skeletor Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Skeletor Posted November 8, 2018 Share Posted November 8, 2018 (edited) I also have a Win10 VM using Oracle's Virtual Box. Try using : \\VBOXSVR\<folder name> Edited November 8, 2018 by Skeletor Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Skeletor Posted November 8, 2018 Share Posted November 8, 2018 Your code worked for me. Did you install Guest Additions? Report_File() Func Report_File() Local $name = @UserName Local $VMSharePointPath = "E:\" $sFileName = ($VMSharePointPath & "Response\" & $name & ".txt") $hFilehandle = FileOpen($sFileName, 2) FileWrite($hFilehandle, "Started" & @CRLF) FileClose($sFileName) EndFunc Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Developers Jos Posted November 8, 2018 Developers Share Posted November 8, 2018 56 minutes ago, Skeletor said: Please use the <> to insert your code. First click on edit to edit your post, cut your code out from your comment and click on the the <> to paste it in. Not possible for new members as they don't have the Edit yet. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Skeletor Posted November 8, 2018 Share Posted November 8, 2018 Oh, did not know that. Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Math31 Posted November 8, 2018 Author Share Posted November 8, 2018 Hello, Skeletor. Thank you for your response. Unfortunately, I am not able to edit my post because probably I don't have sufficient rights on the forum yet. I tried \\VBOXSVR\<folder name> instead of E:/ and it does not help. As for Guest Additions, I did not install it for any VM. Should I install it specially for win10 x64? Link to comment Share on other sites More sharing options...
orbs Posted November 8, 2018 Share Posted November 8, 2018 i can confirm that the OP code works OK on Windows 10 x64 VM in virtualBox in Windows 7 x64 host. points you may want to check: 1) "Guest Additions" installed on the VM. 2) drive later mapping is correct. 3) the subfolder exists on the shared folder, or add the $FO_CREATEPATH flag to FileOpen(). 4) @username contains only valid characters. 5) if it is the same file written to by other guests (or by the host), make sure it is not locked. 6) this is a bug in Windows 10. so, either cross your fingers and update, or re-install the VM from an older source image. Signature - my forum contributions: Spoiler UDF: LFN - support for long file names (over 260 characters) InputImpose - impose valid characters in an input control TimeConvert - convert UTC to/from local time and/or reformat the string representation AMF - accept multiple files from Windows Explorer context menu DateDuration - literal description of the difference between given dates Apps: Touch - set the "modified" timestamp of a file to current time Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes SPDiff - Single-Pane Text Diff Link to comment Share on other sites More sharing options...
Math31 Posted November 8, 2018 Author Share Posted November 8, 2018 Hello orbs. Thank you for you answer. I just checked all VMs and found that I have D:\ drive as VirtualBox Guest Addition and also running Guest Addition icon in Windows tray. So it seems that Guest Additions were already installed on VMs. Link to comment Share on other sites More sharing options...
Skeletor Posted November 8, 2018 Share Posted November 8, 2018 @Math31, Yes, you need to re-install the Guest Additions for Windows 10. Somehow, when you migrate or clone the VM, it looses these settings. Once you done that, make sure your shared folder is still active. Then run your script. For me, my VM is Win10 Pro, Guest additions installed with also and E:\ share folder drive. Kind RegardsSkeletor "Coffee: my defense against going postal." Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI Link to comment Share on other sites More sharing options...
Math31 Posted November 13, 2018 Author Share Posted November 13, 2018 The solution is following for Virtual Machine with Windows 10: To disable UAC completely, the EnableLUAproperty of HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System in the registry needs to be changed to 0. This disables the "administrator in Admin Approval Mode" user type, thus allowing all administrator users to run their processes as administrators by default. After doing that, your programs/processes will be run in Administrator mode by default (given that your user is an Administrator), i.e. you will not be having (so much) trouble saving files to certain locations, without launching the respective program specifically as Administrator first. Link to comment Share on other sites More sharing options...
AdamUL Posted November 13, 2018 Share Posted November 13, 2018 (edited) Instead of disabling UAC completely, why don't you just change "ConsentPromptBehaviorAdmin" to 0. You will not get any prompts for Administrators. I wrote a UDF for working with UAC. Adam Edited November 13, 2018 by AdamUL Earthshine 1 Link to comment Share on other sites More sharing options...
Math31 Posted November 14, 2018 Author Share Posted November 14, 2018 (edited) Adam, thank you for your comment. This issue happens to me ONLY with Virtual Image of Windows 10. Edited November 14, 2018 by Math31 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now