Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
'************************************
'*
'* User Is Administrator (Function)
'* Version 4.0
'*
'************************************
'This function checks to see if the currently logged-in user is an administrator
'Note: Requires WMI
Function UserIsAdministrator
'The local machine
strComputer = "."
'Connect to the registry using WMI
Set fncObjReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
'The key path to check access to
fncStrKeyPath = "SYSTEM\CurrentControlSet"
'Check the users access to delete this component of the registry, and return the result
fncObjReg.CheckAccess HKEY_LOCAL_MACHINE, fncStrKeyPath, DELETE, UserIsAdministrator
End Function
Set WshShell = CreateObject("Wscript.Shell")
'************************************
'*
'* User Is Administrator (Function)
'* Version 3.01
'*
'************************************
'This function checks to see if the currently logged-in user is an administrator
Function UserIsAdministrator
'If we cant create the registry entry when we try, it will return an error, so we need to resume
On Error Resume Next
'Try to write to the root of the registry (only Administrator's can do this)
WshShell.RegWrite "HKLM\TestAdminAccess", "Access Granted"
'Catch the error
If (Err.Number <> 0) Then
'If it errors, we can't create the reg key
UserIsAdministrator = false
Else
'Otherwise, we are an administrator; remove the key
WshShell.RegDelete "HKLM\TestAdminAccess"
'Set the flag to say the user has access
UserIsAdministrator = true
End If
'Clear any errors
Err.Clear
'Turn error reporting back on
On Error Goto 0
End Function