ARPFre Posted March 20, 2022 Share Posted March 20, 2022 expandcollapse popup#include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include <File.au3> #include <String.au3> #include <GuiButton.au3> #include <ComboConstants.au3> #include <Constants.au3> #include <ScreenCapture.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <StaticConstants.au3> #include <EditConstants.au3> #include <GuiStatusBar.au3> #include <AutoItConstants.au3> #include <GuiTab.au3> #RequireAdmin $oMyError = ObjEvent("AutoIt.Error", "ComError") $UserObj = ObjGet("WinNT://" & @LogonDomain & "/" & @UserName) If @error Then MsgBox(0,0,"Not found!",0) Else MsgBox(0,0,$UserObj.FullName, 0) MsgBox(0,0,$UserObj.description, 0) EndIf $UserObj = "" $oMyError = ObjEvent("AutoIt.Error", "") ;COM Error function Func ComError() If IsObj($oMyError) Then $HexNumber = Hex($oMyError.number, 8) SetError($HexNumber) Else SetError(1) EndIf Return 0 EndFunc ;==>ComError Good morning everyone, How can I correct the script below? I am required by definition that the script works with admin powers. When running it brings me the admin user and not the user who is currently logged into Windows. How to fix if possible? Link to comment Share on other sites More sharing options...
Solution Gianni Posted March 21, 2022 Solution Share Posted March 21, 2022 what do you get if you put the following line in your script? MsgBox(0, '', EnvGet('username') & @TAB & @UserName) Are the two usernames the same? ARPFre 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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