Jump to content
Sign in to follow this  
PhilippeHauke

#RequireAdmin issue

Recommended Posts

PhilippeHauke

Hi,

I may miss an obvious point but I dug into forum and googled but it has been no help so far.

I am Vista and AutoItV3.3.8.1

=================

MsgBox(0,"", "aa")

=================

works fine

but

=================

#RequireAdmin

MsgBox(0,"", "aa")

=================

popups UAC panel asking me to continue or cancel (should mean I am actually admin,isn't it?) and exits (code 0) whatever I click "continue" or "cancel"

Any clue?

Thanks in advance

Share this post


Link to post
Share on other sites
guinness

#RequireAdmin is when you need your application to run with full administration rights. For a message box this isn't necessary.


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
JLogan3o13

Hi, PhilippeHauke. The #RequireAdmin is doing just what it is designed to, telling the system your script requires Administrative access (which then kicks off the UAC). I am a little confused as to what you're asking. Are you saying that after clicking OK on the UAC, you're not seeing the message box?


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
PhilippeHauke

Hi, Thanks for reading my post.

Yes, you are right: the program exits directly without displaying the message box.

Share this post


Link to post
Share on other sites
guinness

So you're happy now?


UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 22/04/2018

Share this post


Link to post
Share on other sites
PhilippeHauke

Hi Guiness,

Thanks your your interest too.

My goal is not to display a msgbox but this is the simplest sample of code I found to illustrate the problem I face.

In fact I try to create a user account (using code that works properly with XP) but I struggle porting it to Vista

Share this post


Link to post
Share on other sites
JLogan3o13

Why don't you post your code, so we can take a look :)


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
PhilippeHauke

Because this short code exactly exhibits the issue I face. I have actually tested it.

Don't you agree that the message box should display when I click the "continue" button? It does not.

Don't you agree that the UAC panel (asking for "continue" or "cancel") attests that I am running as administrator?

In fact before reaching this basic code I made some tries and whatever the code I use with "#RequireAdmin", it is not executed.

Share this post


Link to post
Share on other sites
Melba23

PhilippeHauke,

When I run the simple code you posted above on my Vista machine I see the MsgBox - as I would expect. So there must be something else happening which prevents you from seeing it. I am sure you understand that unless you give us some more clues we cannot help you any further. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
PhilippeHauke

I thank you for your help and it is clear to me that it is my interest to help you so you can help me.

So Melba23, you run the code with "#RequireAdmin", you get the UAC panel, you click "Continue" and the msgBox displays "aa"

If the same code works fine in your environment and not in mine, I conclude that our environments differ.

To me, here are some specifications of my environment that might influence

Vista: "Edition Familiale Premium" - Service Pack 2 - 64 bits

AutoIt: V3.3.8.

UAC is "On"

if you have in mind any other information (register, environment variable...) that might influence, please let me know.

Share this post


Link to post
Share on other sites
Melba23

PhilippeHauke,

You and I both have the same OS and AutoIt versions. Do you have any AV or HIPS programs running which might not permit you to run a second instance of AutoIt as an Admin? I have to confirm each time with my Comodo HIPS that I am allowing this to happen. ;)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
PhilippeHauke

Melba23,

I don't think but herebelow is the list of my installed programs

Adobe Flash Player 11 ActiveX

Adobe Reader 9

Atheros Communications Inc® L1 Gigabit Ethernet driver

AusLogics Disk Defrag

AutoIt v3.3.8.1

Avast ! Free antivirus

Cute PDf writer 3.0

Dropbox

ExpertTool

Google chrome

Microsoft Expression Web

Microsoft office Enterprise 2007

Microsoft Office Project Professional 2007

Microsoft Office Visio Professional 2007

Microsoft Visual C++ 2005 Redistributable

Microsoft Visual C++ 2008 Redistributable – x86…

Mozilla Firefox 18.02

Mozilla maintenance Service

muveeNow2.1

Nvidia drivers

PyScripter 2.5.3

Python2.7 PySide-1.1.2

Python2.7 pywin32-218

Python2.7

Realtek High Defintion Audio Driver

Ride Equitation nouvelle génération 1

Windows desktop search : add-in for files on Microsft Networks

Share this post


Link to post
Share on other sites
JLogan3o13

Number 6 - Avast! Try disabling it.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
PhilippeHauke

I disabled Avast agents + Windows firewall but the behavior did not change (still KO with #RequireAdmin).

For information here are the traces of the run:

>"C:Program Files (x86)AutoIt3SciTE..autoit3.exe" /ErrorStdOut "W:_ToolsAutoItPC_OLIVIERessai4.au3"

>Exit code: 0 Time: 2.270

As you can notice, I run Autoit in 32 bits mode. Might it explain anything?

Share this post


Link to post
Share on other sites
PhilippeHauke

Fyi, I uninstalled and reinstalled AutoIt => non change (the problem is still there)

Maybe more interesting. Before I always ran the code from ScITE. After, I tried to run it from the file browser. I compiled (x86) and ran it using "run as administrator", I got 3 popups; one of them (the last one) requesting username and pwd. I filled the <hostname>/<username> and <pwd> and I finally got a message "the specified username is not valid".

I am not sure that the syntax <hostname>/<username> (with all characters in lowercase) is the correct one.

Any idea?

Share this post


Link to post
Share on other sites
PhilippeHauke

I have a major progress :shifty: to report and then some more accurate questions.

In fact, the popup asking for username/pwd (see my previous post) comes because my script is stored in a network disk (see the traces in my post before last "W:_ToolsAutoItPC_OLIVIERessai4.au3")

When I move my script to my desktop and run it (whatever it is from SciTE or from file browser), it works well (I mean the msgbox is displayed).

So I am starting to get happy :shifty: and I would get fully happy if got a mean to run the scripts directly from its network disk location

- mode 1 (run from file browser): what is the correct syntax of the username to fill in the network access popoup ("//diskstation/olivier" does not work

- mode 2 (run from SciTE): is there any way to run a #RequireAdmin script that is stored in a network disk. As i told you, when I run it, there is no error/warning message but no instructions are executed

Thanks in advance

Share this post


Link to post
Share on other sites
PhilippeHauke

Hreeafter is a recap (I hope it may motivates feedbacks)

I store my AutotIt scripts on a NAS disk and I have noticed that when I run a script from SciTE with #requireAdmin# statement then no instructions are executed and no message is displayed (SciTE just reports exit code 0).

If I remove the #requireAdmin statement then the instructions of the script get properly executed.

If I copy the script with the #requireAdmin statement on a local disk and run it from SciTE then it works properly (I need to confirm the run request in a popup first)

Would anybody have an idea about the reasons of this behaviour and the way to run the remote script directly from SciTE?

Share this post


Link to post
Share on other sites
BrewManNH

Its because when you use RequireAdmin, it restarts the script under different credentials. Those credentials don't have the network drive mapped or accessible, so it can't find the file(s) to run.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
PhilippeHauke

Thanks BrewManNH,

So, I understand that either I use #RequireAdmin and I then cannot access network resources or I don't use it and I then cannot access features such as user account creation, software installation....

Am I right ? Is there a way to workaround this frustrating status?

Isn't there any way to keep or recover my user account (here my user account has administrator privilleges) with #RequireAdmin?

Share this post


Link to post
Share on other sites
BrewManNH

If you have to use #RequireAdmin, then you have to remap the drives that the files are located on afterwards. Otherwise, the script can't find the files. Use DriveMapAdd to remap the drive, you probably don't want the drive mapping to be presistent though so make sure you set that to no.

  • Like 1

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×