Jump to content

rsn

Active Members
  • Posts

    132
  • Joined

  • Last visited

  • Days Won

    2

Community Answers

  1. rsn's post in Can't stop/start service on Windows 11 Pro system was marked as the answer   
    @Jemboy The user you created and assigned permissions to control the spooler doesn't have to be in the administrators group. By not being in that group it adds the advantage of not being able to control any other service or admin level processes. And your script wouldn't need #RequireAdmin either. 
    I'll run a couple extra tests today just in case I'm talking out of my butt 
    I ran some tests. I created a local non-admin user and assigned Full Control to the spooler:

    Then ran the following: 
    #include <AutoItConstants.au3> RunAs ( "testuser" , "." , "password" , $RUN_LOGON_NOPROFILE , @ComSpec & " /k sc.exe stop spooler" , "C:\windows\system32" , @SW_SHOWDEFAULT ) And the service stopped  You can use any method you want but I chose SC.exe for simplicity in this example.
  2. rsn's post in How to add your AutoIt .exe to suggested list "Open Pick an app?" was marked as the answer   
    If you want your app to be on the list, you have to register it as a protocol handler. I've had to fix handlers in the past but never had to create one. The info here seems to be easy enough to follow to modify the keys in:
    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\tel  
  3. rsn's post in Converting AM/PM time to 24-hour was marked as the answer   
    Change 
    $ret = $hr + ":" + $min to 
    $ret = $hr & ":" & $min  
  4. rsn's post in Automating: Logging out as User 1 and then Logging in as User 2 was marked as the answer   
    Autologon takes command line arguments so using it might be simpler than you think. 
    autologon.exe <username> <domain> <password> If the PC in question isn't joined to a Windows Domain, you would use the name of the PC. Example from the command line:
    autologon.exe noellarkin %COMPUTERNAME% MyC0mplexP@ssword Right before you trigger your logoff use autologon to set whoever you want to log in next. Example in AutoIt:
    $iPID = Run ( @ComSpec & " /c c:\path\to\autologon.exe noellarkin " & @computername & " MyC0mplexP@ssword" , "" , @SW_HIDE ) ProcessWaitClose($iPID) Shutdown (0)  
  5. rsn's post in [SOLVED] Enabling / Disabling network interfaces by non-privileged user was marked as the answer   
    My guess is that the runas is working, but the process being run isn't elevated. When I was doing something similar, I used elevate.exe (here) to get the process I used runas on to actually have the admin token attached to it.
     
    Edit: I think there's more to it than just the above so I'll have to dig up the old script. 
    Edit2: There is more: In order for elevate.exe to work, you'll have to click through a UAC dialog (or disable UAC). I had forgotten that I had to abandon my original script and deploy it through SCCM which uses the local system user. However since you're dealing with the NIC, that's probably not be feasible since the PCs in question can't talk to the network. 
  6. rsn's post in MailTo in compiled script starts Outlook configuration (not Outlook) was marked as the answer   
    I was unable to duplicate your results. When compiled or run from SciTE, if I didn't have a default mail client selected, it prompted me for an action. When I selected a default mail client (hat tip @ioa747) , it opened a compose email window in outlook or more options in Firefox.
    Note that the MailTo class you referenced doesn't set the default mail client in Win8 or later. Microsoft migrated it to "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\mailto" in more recent builds of Windows and it's hashed so you can't just edit it (see here).
    Which leads us to how to set that: I've used SetFTA (here) or via @Danyfirex's AutoIT only solution (here). You'll still have to determine which mail client is installed but after setting whatever that is, you can use ShellExecute to your hearts delight.
     
  7. rsn's post in If statement was marked as the answer   
    Maybe differentiate it as part of the argument of the function?
    checkOrOpenExcel("1") Func checkOrOpenExcel($sArg)     If ProcessExists ("excel.exe") Then         msgbox($MB_SYSTEMMODAL, "", "File is Already Open")     else if $sArg=1 then evap1() if $sArg=2 then evap2()     EndIf EndFunc There are probably much better ways to do it since the above may trigger overflow if you have a loop going.
  8. rsn's post in Application Is blocked was marked as the answer   
    If your organization is using Palo Alto Networks Anti Malware stuff, you (or whoever manages it) will likely have to open a support ticket to get an exception put in place for the false positive.
    See here.
  9. rsn's post in Trouble getting battery info for laptop was marked as the answer   
    Try this:
    #include <MsgBoxConstants.au3> $WMIObj = ObjGet("winmgmts:\\.\root\wmi") If @error Then MsgBox($MB_ICONERROR + $MB_TASKMODAL, @ScriptName, "Error getting wmi : " & Hex(@error, 8) , 10) Exit Else $WMIObjItems = $WMIObj.ExecQuery("select RemainingCapacity FROM BatteryStatus") If IsObj($WMIObjItems) Then For $oItem In $WMIObjItems $iRemainingCapacity = $oItem.RemainingCapacity Next EndIf EndIf MsgBox (4096 , @ScriptName , "Remaining battery capacity in milliwatt hours=" & $iRemainingCapacity ) On the Dell laptop I use, the script returned 35226 @ 100% battery and 34531 @ 98%.
     
    rsn
×
×
  • Create New...