Check if the script has elevated permissions

后端 未结 5 2126
情书的邮戳
情书的邮戳 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 04:57

    The code above that requires "whoami" is from our IfUserPerms script at CSI-Windows.com/toolkit/ifuserperms.

    After reading your post here, I have created new script code that checks for admin rights with fast, small, efficient, passive (no changing anything) code in both VBS (9 Lines) and CMD/BAT (3 lines). It also works with UAC by reporting false if the user is not elevated.

    You can find the code here: http://csi-windows.com/toolkit/csi-isadmin

提交回复
热议问题