Jump to content

run a script with advanced permissions


Recommended Posts

 

Hello all of you, I have a problem, what happens is that I want to execute BlockInput in my code, since when I carry out a scheduled process it does not work for me unless I execute it as administrator by clicking manually.

I would like to know if there is any way to include the administrator user with the password in the code so that it runs with elevated permissions.

I tried to use runes, but it doesn't do anything or I don't know if the syntax is wrong

#include <WinAPI.

$usuario = "dominio\administrador"
$contrasena = "contraseña"

; Ejecutar AutoIt como administrador
RunAs($usuario, "",$contrasena, 0, @AutoItExe & " " & '"' & @ScriptFullPath & '" ')

; Bloquear entrada
BlockInput(1)
Sleep(15000)
BlockInput(0)

MsgBox(64, "prueba", "termino la ejecucion")

Thank you so much

Edited by stiv
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...