Search the Community
Showing results for tags 'admin'.
-
hello autoit team is there any wey to check if any process run as admin or no? i mean e.g if i want to restart any process, now i have the ability to get the process path and commands line what i need is a wey to check if the process was runing as admin or no to restart it with the same state. here is the part that am using it to restart the process func _processRestart($i_pid, $s_ProcessPath) if not (ProcessExists($i_ProcessPid)) then return SetError(1, 0, -1) local $s_ProcessWorkDir = _WinAPI_GetProcessWorkingDirectory($i_ProcessPid) ProcessClose($i_ProcessPid) ProcessWaitClose($i_ProcessPid) ProcessWait(ShellExecute($i_pid,"", $s_ProcessWorkDir)) ProcessesGetList() return true endFunc thanks in advance
-
#include <GUIConstantsEx.au3> SoundPlay("shadow.wav") Local $name = InputBox("Server Name", "Input server name ", "google.com", "", _ - 1, -1, 780, 312) If @error Then Return Remote() Func remote() ; Main Accounts Local $main = GUICreate("Shadow Remote v1.2",400,350,700,200) GUICtrlCreatePic("logo.jpg", 0, 0, 400, 350) GUICtrlSetState(-1,$GUI_DISABLE) Local $qwinsta= GUICtrlCreateButton ("Open Sessions",50,60,80,20) GUICtrlSetBkColor(-1, 0xFFFFFF) Local $connect = GUICtrlCreateButton ("Connect Session",260,60,90,20) GUICtrlSetBkColor(-1, 0xFFFFFF) Local $kill = GUICtrlCreateButton ("Close Session",260,90,90,20) GUICtrlSetBkColor(-1, 0xFFFFFF) Local $end = GUICtrlCreateButton("Terminate", 160, 280, 80, 20) GUICtrlSetBkColor(-1, 0xFFFFFF) ; Display the GUI. GUISetState(@SW_SHOW, $main) Local $iPID = 0 ; Loop until the user exits. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop ;main cases case $qwinsta $iPID = qwinsta() case $connect $iPID = connect() case $kill $iPID = kill() case $end $iPID = end() EndSwitch WEnd ; Delete the previous GUI and all controls. GUIDelete($main) EndFunc ;==>Example ;main functions Func qwinsta() Run(@ComSpec & ' /k qwinsta.bat') Sleep(5000) Send("{space}") EndFunc Func connect() Local $session = InputBox("Session", "Input session number ", "", "", _ - 1, -1, 780, 312) $cmd= "MSTSC /Shadow:" & $session & " /Control /NoConsentPrompt" If @error Then Return RunWait('"' & @ComSpec & '" /k ' & $cmd) Sleep(1000) Send("exit") Send("{enter}") EndFunc Func kill() Local $session = InputBox("Session", "Input session number ", "", "", _ - 1, -1, 780, 312) $cmd= "rwinsta /server:" & $name & " " & $session If @error Then Return RunWait('"' & @ComSpec & '" /k ' & $cmd) EndFunc Func end() SoundPlay("shadow.wav") sleep(2200) exit EndFunc A GUI for server admins to connect a user´s session as admin without 3rd party software , previously is need to edit a GPO. I share it if anyone finds it useful or make it better. qwinsta.bat
- 1 reply
-
- rdp gui com
- rdp audit
-
(and 1 more)
Tagged with:
-
I am looking for advice on next trouble shooting steps for my problem. I have researched this over the last three days and still not solved it. The main reason "run Scite works, exe doesnt" occurs seems to be duplicate names in executable files but I made sure I do not have that problem. I have a "trivial" script that watches for a login window to pop up, inserts PW and enter/closes. It worked for a year then I experimented with #RequireAdmin on another problem and ran/compiled this one with RequireAdmin to check out what happens as a learning excercise. Now the compiled version MUST be run with admin rights, and I get the UAC approval window which I must avoid in my application, but the SciTe editor version runs from the tools menu (F5) just fine, no UAC. The correlation between using RequireAdmin for a while and the run problem is probably just a coincidence, but I am suspicious. #include <MsgBoxConstants.au3> ;#RequireAdmin ;trying with and without #requireadmin Opt("SendCapslockMode", 0) ;make sure caps are off Send("{CapsLock off}") Local $myTitle = "User Login Dialog" Local $myPW = "password" & "{ENTER} ; Wait max 10 seconds for the Sign In window to appear. If Not (WinWait($myTitle, "", 10)) Then MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "Error", "LogIn window did not appear or is timed out") EndIf If WinActivate($myTitle) Then ControlSend($myTitle, "", "", $myPW ) ;alternate, also works in editor ;Send($myPW & "{ENTER}") ;MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "INFO", "SENT $myPW enter") Else MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "Error", "Sign In Window did not activate") EndIf Sleep(2000) If (WinExists($myTitle)) Then MsgBox($MB_SYSTEMMODAL + $MB_ICONERROR, "Error", "LOGIN FAILED") EndIf More info that may be relevant, at least as background info: The LogIn window is from a custom addin to Excel, does not have control ID access to the user/pw entry locations, just the enter/cancel buttons are found by AU3Info. Thus I had to resort to Send, or ControlSend with just the default selection on popup of where the entries go. Fortunately the UserID area remains populated between uses and the PW entry "window" is automatically selected at window popup so I just enter PW text and {enter}. I can run the compiled file as administrator, OK the UAC window "do you want to allow...", and it runs. (right click the file in file explorer, select "Run as Administrator". Trying to accept this issue I tried ways to "bypass" the UAC window. I followed instructions on CNET to run the exe file as administrator automatically but the UAC window still comes up: Always run a program in administrator mode in Windows 10 - CNET I tried to create a shortcut to the exe file through the scheduler following these instructions (other links give the same set of instructions), did not seem to run at all, could not track down any errors I might have made. Open any program as administrator without UAC prompt (winaero.com) Is there any system settings permanently changed by RequireAdmin? What should I look at to have the exe file run without the UAC window? Regards and stay healthy!
-
I'm trying to install some setup stuff on Win10. One part of the script requires just regular user privileges but the other requires admin privileges. When I run it from the Autoit Editor it works like a champ. When I build it, Windows slaps the admin stamp on it and then when I attempt to run the part that only requires regular users....it gets all hosed up. Is there a way to remove #RequireAdmin? I've tried RunAs(username, "", myPassword, "", "cmd.exe", "") but that never seems to work. Can someone help me out?
-
Hello all I have a question please Is there a way to request the script for administrator privileges if a particular condition is met?? example local $path = RegRead("HKEY_CURRENT_USER\Software\test", "fullpath") if $fullPath = @scriptFullPath then Request for administrator privileges main() else main() endIf I hope to find a solution here Greetings to all
-
Hello all, this is what I got so far .. it opens and It won't put in words, I need to log in,, oops didnt put in code. LOL #include <IE.au3> Local $oUser, $oPass, $oSubmit Local $sUser = "lit" Local $sPass = "abc" Local $url = "http://woodstock:9090/login.jsp?url=%2Findex.jsp" Local $oIE = _IECreate($url, 1) _IELoadWait($oIE) $oInputs = _IETagNameGetCollection($oIE, "input") for $oInput in $oInputs if $oInput.type = "text" And $oInput.name = "userid" And $oInput.size = "12" Then $oUser = $oInput if $oInput.type = "password" And $oInput.name = "password" And $oInput.size = "12" Then $oPass = $oInput if $oInput.type = "submit" And $oInput.value = "loginformtable" Then $oSubmit = $oInput if isObj($oUser) And isObj($oPass) And isObj($oSubmit) then exitloop Next $oUser.value = $sUser $oPass.value = $sPass _IEAction($oSubmit, "click") _IELoadWait($oIE) 1
-
Hello everyone, I'm working on a WMIC uninstaller. A quite simple one with a button to display product names in a editable list (for copy/paste purposes) but the main problem is that in order to achieve this, in my corporation, normal users cannot uninstall softs. What I found/adapt so far: #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("wmic uninstaller", 300, 152, 337, 380) $Label1 = GUICtrlCreateLabel("Computername", 0, 8, 75, 17) $Input1 = GUICtrlCreateInput(@ComputerName, 0, 32, 125, 21) $Label2 = GUICtrlCreateLabel("wmic command", 150, 8, 77, 17) $Combo1 = GUICtrlCreateCombo("Model_Computer", 150, 32, 125, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "Current_user|Installed_Apps|Serial_Number|Bios_Version") $Button1 = GUICtrlCreateButton("List Apps", 150, 72, 91, 49) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $button1 $wmi = GUICtrlRead($combo1) $pc = GUICtrlRead($input1) call($wmi,$pc) EndSwitch WEnd Func Model_Computer($pc) RunWait(@ComSpec & ' /c ' & 'wmic /node:' & $pc &' product get name > %temp%\apps.txt' ,"", @SW_HIDE) $file=(@TempDir & "/apps.txt") $fileread= FileRead($file) MsgBox(0, $pc , $fileread) FileDelete(@TempDir & "/apps.txt") EndFunc Here's the textual version I gave to my techs: Create cmd shortcut on Desktop, run it as a different user (using their own admin accounts).Once opened, type wmicOnce wmic loaded, type product get nameWait for the list of installed soft to displayType product where name="Exact App name" call uninstallType "Y" to confirmWait for task executionDon't care about exit codeApp is uninstalled (verified by getting the list again)!In fact, I'd like to automatize this process. Any ideas over here? Thanks ^^
-
I created a script and I'm ready to launch it at windows start-up and want to do it as Admin in order to use the script also when a window has UAC enabled. But... - When I right click on the file there is No option "Run as Administrator" - I tried to add the file to task scheduler with elevated rights, but when I run the task it edits the file (in SciTE4) - When I push down the CTRL & SHIFT key and click the script file, the same thing happens as running the task in task scheduler. I'm the admin of the pc and I can run non autoit programs/scripts on above ways. I tried to reinstall the autoit setup exe file running as administrator but it didn't resolve the problem. What did I wrong? How can I run the script with elevated rights in task scheduler? ps: I'm running win8 64 bits, but installed autoit in 32bits mode.
-
This is Something i Made to block Applications from Being Used without Using the Windows UAC and Stuff. Its Quicker and it Works. Let me know what You Think. You Need the config.ini file in the Folder with the Script. Admin System.rar
-
Hi! I have a question...i need to run "this" on the 500 PC, on every PC is the same user and pass for admin. Team viewer Host proces can't be killed if i am not admin. So the question is how to run the CMD with admin Rights. (example: User:Admin | Pass: 0000) I try the command runas but nothing happens. i will be very gratefull if someone can type just example script. Thnx in advanced.
-
Hey guys, I just came across this thread; Where the poster asked how to run an internal function with admin rights. As far as I am aware, there has never been a script example of this. As is debated for the next 10 or so posts, this is not actually running the function with admin rights, it re-runs the file with admin credentials, runs the function with the parameter "a" (This can be changed) and then runs the function, which checks that the user is admin. What happens if they are admin, and what happens if they are not admin can, ofcourse, be changed. So I'll cut the chit-chat, here is the example: For $Repeat = 1 To $CmdLine[0];The $cmdline array is automatically set by autoit. It contains any parameters given to the program when it is run. ;Hold Shift and press F8 in scite to set parameters. Enter "a" into the first box, without quotes. MsgBox(0,"",$CmdLine[$Repeat]) ;For debug reasons - shows you what the current parameter is. If $CmdLine[$Repeat] = "a" Then ;Checks to see that the current parameter is "a" _AdminFunction() EndIf Next If @Compiled = 1 Then RunAs(InputBox("Username", "Insert the username of the administrator", "Administrator"), "", InputBox("Password", "Insert the password of the admin account.", ""), 0, FileGetShortName(@ScriptFullPath) & " a");Runs the compiled script with the a parameter Else RunAs(InputBox("Username", "Insert the username of the administrator", "Administrator"), "", InputBox("Password", "Insert the password of the admin account.", ""), 0, FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath)& " a");Runs the uncompiled script with the a parameter EndIf Func _AdminFunction() If IsAdmin() Then;Ensures that the current user is admin as a normal user could run the program with the parameter set (if they have access to the code or try the parameter by pure chance to see what it does) MsgBox(0,"","Running Function as Admin") ;You can place your required script here. Else MsgBox(0,"","Running Function as Normal User. Function will not attempt") ;Function is not run be an administrator and so it will exit. EndIf Exit EndFuncI have tried this from a guest account on my computer (with and without credentials) and it has worked perfectly. I also tried running it as both compiled, and uncompiled, and again, it worked exactly as expected. It might not be something that people will use all the time, but it's here for anybody who does need it, and I am quite happy with it. A few other ideas I have had since writing this scipt, as to how it may communicate involve writing to the STDOUT stream at the end of the function, and having the calling part of the script read it, or using mailslot which is inter-script communication.
-
I have been searching for 5 hours now, and I can't find any information about how to send DOS-commands to another computer remote without having the script on the computer. And I could go another way by editing Registry by remote, but I don't know how or if I can add users(domain) to be an administrator account. (I know this is not really that related to AutoIT, but it is part of my script). All help will be appreciated Kind Regards, Akarillon