Best way to know if a user has administrative privileges from a VBScript

后端 未结 10 1914
不知归路
不知归路 2021-01-02 21:50

I need to check whether the user executing the script has administrative privileges on the machine.

I have specified the user executing the script because the script

10条回答
  •  生来不讨喜
    2021-01-02 22:06

    Yet another quick n dirty method. Returns <> 0 If IsNotAdmin

    Function IsNotAdmin()
        With CreateObject("Wscript.Shell")
            IsNotAdmin = .Run("%comspec% /c OPENFILES > nul", 0, True)
        End With
    End Function
    

提交回复
热议问题