请问如何用程序判断机器是否已装IIS,如何得知当前windows登录用户隶属于Administrators? 谢谢。

解决方案 »

  1.   

    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的代码,不知道那个GetObject是不是和CreateOleVarant差不多