Re: Help getting user account kind from IE by JHP
JHP
Wed Sep 13 11:21:43 CDT 2006
See if parts of this work for you:
(watch for word wrap)
Option Explicit
On Error Resume Next
Dim strComputer, strProcess, strGroup, objWMIService, objProcess
Dim rtnProcess, strUserName, strDomainName, objGroup, rtnMember
strComputer = "."
strProcess = "iexplore.exe"
strGroup = "Administrators"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set objProcess = objWMIService.ExecQuery("SELECT name FROM Win32_Process
WHERE name = '" & strProcess & "'")
If objProcess.Count > 0 Then
For Each rtnProcess In objProcess
If LCase(rtnProcess.Name) = strProcess Then
rtnProcess.GetOwner strUserName, strDomainName
Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup &
",Group")
If Err.Number = 0 Then
rtnMember = objGroup.IsMember("WinNT://" & strDomainName & "/" &
strUserName)
Set objGroup = Nothing
If rtnMember Then
WScript.Echo strUserName & " has " & strGroup & " Privileges - " &
strProcess & " will be Terminated"
rtnProcess.Terminate()
Else
WScript.Echo strUserName & " is not a Member of " & strGroup
Exit For
End If
Else
WScript.Echo Err.Number
Err.Clear
End If
End If
Next
Else
WScript.Echo strProcess & " is not running on " & strComputer
End If
Set objProcess = Nothing
Set objWMIService = Nothing
<fltcpt@yahoo.com> wrote in message
news:1158126174.906675.246600@d34g2000cwd.googlegroups.com...
> Hi,
>
> Any body knows how to check user privilege with vbscript
> on IE? User privilege as in whether the user is running
> IE with admin or limited user priv.
>
> I've been thinking down the line of writing to registry with WScript
> and see if it fails... but I prefer the method to not invlove any
> warning messages for my users (IE warns about unsafe script
> for WScript...)
>
> Thanks.
>