Check if the script has elevated permissions

后端 未结 5 2124
情书的邮戳
情书的邮戳 2021-01-01 04:14

I would like to check whether the context in which my VBscript runs allows me to perform administrative tasks.

Requirements:

  • The solution should
5条回答
  •  一整个雨季
    2021-01-01 05:17

    Here is the fastest way to cause a script file or any other file run as administrator:

    First create your VBS script of whatever you need to do. In my case it was a registry edit vbs to allow me to autoadmin logon then when the machine was restarted, another file was run to ensure that autoadmin logon was not enabled any longer.

    After you have created your file, then you need to create a cmd prompt shortcut. Next 'Right click' on the shortcut and change the propeties so that it will run as administrator.

    Paste your file path like this: D:\WINDOWS\system32\cmd.exe /c "D:\Dump\Scripts\StartUp.vbs"

    The 'C' means it will close after completion If you want it to stay open then use 'K'

    Hope this helps someone else.

提交回复
热议问题