Function IsAdmin()
Dim oShell
Dim oFSO
Dim sTemp
Dim sTempFile
Dim fFile
Dim sResults
Const OpenAsDefault = -2
Const FailIfNotExist = 0
Const ForReading = 1
Set oShell = CreateObject("WScript.Shell")
Set oFSO = CreateObject("Scripting.FileSystemObject")
sTemp = oShell.ExpandEnvironmentStrings("%TEMP%")
sTempFile = sTemp & "\inv_isadmin.tmp"
oShell.Run "%comspec% /c kix32 %systemroot%\userislocaladmin.kix"
End Function
Private Sub CompAvail()
If IsConnectible(strComputer, 1, 750) Then 'Pings strComputer
If IsAdmin = 1 Then
WMIwrapper
Else: MsgBox " The operation has received an error. It is highly likely that" & Chr(13) & _
" you received this error due to a lack of administrator privileges " & Chr(13) & _
" on the remote computer. Please check the computer before " & Chr(13) & _
" reattempting this connection.", vbExclamation, "Error - Check permissions"
End If
Else:
Err_Handler
End If
End Sub