Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.9 KiB

  1. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  2. ' SecureLaunch.vbs
  3. ' Launch the Web UI for Remote Administration in IE
  4. '
  5. ' Copyright (c) Microsoft Corporation. All rights reserved.
  6. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  7. On Error Resume Next
  8. webSrvName = GetWebSrvNum("Administration")
  9. ' Check if the Administration site exists
  10. If Not (webSrvName = 0) Then
  11. ' Get the SSL port for the Admin site
  12. Set oWebSrv = GetObject("IIS://localhost/w3svc/" & webSrvName)
  13. sslPort = Split(oWebSrv.SecureBindings(0)(0), ":")
  14. ' Construct the URL
  15. Set sysInfo = CreateObject("WinNTSystemInfo")
  16. strURL = "https://" & sysInfo.ComputerName & ":" & sslPort(1) & "/"
  17. ' Open the URL with IE
  18. Set WshShell = CreateObject("WScript.Shell")
  19. strIExploreKey = "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths\IEXPLORE.EXE\"
  20. strCommand = """" & WshShell.RegRead(strIExploreKey) & """ " & strURL
  21. WshShell.Run strCommand, 3, FALSE
  22. End If
  23. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  24. ' GetWebSrvNum
  25. ' Get the number of the web site with the given name
  26. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  27. Function GetWebSrvNum(strWebSiteName)
  28. On Error Resume Next
  29. GetWebSrvNum = 0
  30. Const REGKEY_WEBFRAMEWORK = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerAppliance\WebFramework\"
  31. Set WshShell = CreateObject("WScript.Shell")
  32. Dim nSiteID : nSiteID = WshShell.RegRead(REGKEY_WEBFRAMEWORK & strWebSiteName & "SiteID")
  33. If (nSiteID <> 0) Then
  34. Set oWebSite = GetObject("IIS://localhost/w3svc/" & nSiteID)
  35. If Err.number = 0 Then
  36. 'The website exists
  37. GetWebSrvNum = nSiteID
  38. End If
  39. Err.Clear
  40. End If
  41. End Function