c#中怎样才能知道某个用户在不在administrators组里呢?请教!

解决方案 »

  1.   

    http://dev.yesky.com/msdn/121/2307121.shtml
      

  2.   

    Dim computername
    computername = getPcName()
    Check3W = False
    Dim www As IADs
    Dim SysPath As String '系统所在目录,指系统的system32目录
    On Error Resume Next
    Set www = GetObject("IIS://" & computername & "/W3SVC")
    Set ftp = GetObject("IIS://" & computername & "/MSFTPSVC")
    If Not (IsObject(www) And IsObject(ftp)) Then   '不存在www服务,则返回false
       Check3W = False
    Else
        Check3W = True
        '启动iis服务(用shell)。
        SysPath = VBGetSystemDir()   '取得系统目录
        iisstarpath = SysPath & "\iisreset.exe /start"
        Dim cmdshell
        cmdshell = Shell(iisstarpath, 0)   ' 启动iis
        If cmdshell = 0 Then    '不能启动
            Check3W = False
            MsgBox "IIS服务不能启动,你需要手工启动IIS服务!B/S部分没有安装到本机器上!"
        End If
    End If
    Set www = Nothing
    Set ftp = Nothing
    '找了个vb代码,可以改造一下
    '
      

  3.   

    ref:
    http://www.codeproject.com/useritems/UserManager.asp