StOngeCompany Posted May 7, 2010 Share Posted May 7, 2010 Hello AutoIt forums, I am wondering if there is any documentation or previous posts (I was unable to find any) that relate to running scripts under Windows 7 without turning UAC off. I've tried right-clicking and hitting Run as Administrator but that doesn't seem to do it. My script works in Windows XP, but not in Windows 7 because of a permissions issue. And yes, I did try it with #RequireAdmin at the top of the script. Here is my script: #RequireAdmin ; Gather User Name $user = InputBox("SOCO AutoCAD Installer", "Please enter your User Name.") ; Create Directory DirCreate("C:\Program Files\AutoCAD 2010\SOCO") ; Copy Directories DirCopy("H:\Installs\SOCAD_r7.0", "C:\Program Files\AutoCAD 2010\SOCO", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_pgp", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_lsp", "C:\Program Files\AutoCAD 2010\Support", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\acad_cui", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\ToolPalette", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\ToolPalette", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\RegisteredTools", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\RegisteredTools", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\setup\support\Profiles", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\Profiles", 1) DirCopy("C:\Program Files\AutoCAD 2010\SOCO\plotters", "C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Plotters", 1) ; Delete File FileDelete("C:\Users\" & $user & "\AppData\Local\AutoDesk\AutoCAD 2010\R16.2\enu\Support\acad.mnr") ; Inform User of Completion MsgBox(4096, "SOCO AutoCAD Installer", "SOCO AutoCAD installation complete!") Is there something I am missing or is it not possible to run scripts under Windows 7 with UAC on? Any help is greatly apppreciated. Thanks, DJ Berndt Link to comment Share on other sites More sharing options...
zorphnog Posted May 7, 2010 Share Posted May 7, 2010 If you are compiling the script you might want to try adding the requestedExecutionLevel directive: #AutoIt3Wrapper_res_requestedExecutionLevel=requireAdministrator Link to comment Share on other sites More sharing options...
SKlocke Posted May 7, 2010 Share Posted May 7, 2010 I also use the approach zorphnog mentions, compiled scripts as this tells AutoItWrapper to modify the manifest of the resulting executable. When I tried using #RequireAdmin, there was a bug when UAC was turned off. But it worked fine with UAC turned on (this sounds like what you have). So what happens with your script, does the DirCreate work, the first DirCopy where you do not use the $user? Link to comment Share on other sites More sharing options...
StOngeCompany Posted May 7, 2010 Author Share Posted May 7, 2010 I added the following line of code to my script: #AutoIt3Wrapper_res_requestedExecutionLevel=requireAdministrator It still fails to copy the files from the network drive to the Program Files directory. It creates the directory just fine, but doesn't do anything else. It's funny because the script runs to completion (the Message Box comes up at the end), but no files have been copied from the network. If I try to manually copy the files from the network drive in the Program Files directory, it asks for Administrative permissions. Is there anything I can do besides disabling the UAC? Thanks for your help so far and for any future assistance!, DJ Berndt Link to comment Share on other sites More sharing options...
SKlocke Posted May 7, 2010 Share Posted May 7, 2010 H: is a network folder, mapped to the drive letter? Try to give the network address, as in \\server\folder\. I think UAC introduces some kind of virtual user context, and if your folder mapping is executed on logon, it is not present when UAC switches user. Also, you could look at the FileInstall function. This will include a target file during compile time and allow you to put it at a location during run time. Link to comment Share on other sites More sharing options...
StOngeCompany Posted May 7, 2010 Author Share Posted May 7, 2010 I tried using \\server\share instead of the drive letter and it worked! Thanks so much for your help everyone. 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