Link to home
Create AccountLog in
Avatar of ARampton
ARamptonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Windows 7 Domain Login Script Progress Feedback

I have a nice login script that uses an IE windows to provide progress of each step in my vbs script as it starts and completes - great for showing up error too

This works great in Windows XP but all feedback is hidden when this user login script is progressing in Windows 7 - it seems to run but as I can't see it I don't know what fails

Any simple ways of making this window show?

Sample of IE windows and text it returns attached
Dim MsgIn
Sub WriteLnIE(MsgIn)
	objExplorer.Document.Body.InnerHTML = objExplorer.Document.Body.InnerHTML & MsgIn & HTMLCR
	objShell.AppActivate ("StubbsRich - Microsoft Internet Explorer Window")
	objShell.SendKeys "{PGDN}"
End Sub

' Write output to IE window without Carriage Return
Sub WriteIE(MsgIn)
	objExplorer.Document.Body.InnerHTML = objExplorer.Document.Body.InnerHTML & MsgIn
	objShell.AppActivate ("StubbsRich - Microsoft Internet Explorer Window")
	objShell.SendKeys "{PGDN}"
End Sub

' Set up IE window for output.
Set objExplorer = WScript.CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"
objExplorer.Document.Title = "StubbsRich Logon Script"
objExplorer.ToolBar = 0
objExplorer.StatusBar = 0
objExplorer.Width = 500
objExplorer.Height = 800 
objExplorer.Left = 400
objExplorer.Top = 0

Do While (objExplorer.Busy)
    Wscript.Sleep 200
Loop

objExplorer.Visible = 1
objExplorer.Document.Body.InnerHTML = "<HTML><BODY>"															' HTML Headers
WriteIE("<H1>StubbsRich Logon Script</H1>")
WriteIE("<H2>Creating User-Specific Settings ...</H2>")
WriteIE("Reading Active Directory")

Set objConn=Createobject("ADODB.Connection")
Set objCmd=Createobject("ADODB.Command")

' Create ldap query

' objCmd.ActiveConnection = objConn
Set objRoot=Getobject("LDAP://RootDSE")
Set objDomain=Getobject("LDAP://"& objRoot.get("DefaultNamingContext"))

strQuery="Select givenname,sn,telephonenumber, ADsPath from '" & _  
objDomain.AdsPath & "' Where objectCategory='person' AND " & _
	"objectclass='user'" & _
	" AND sAMAccountName='" & strUsername & "'"
	
Set objCatalog=Getobject("GC:")
For Each objItem In objCatalog  
	Set objGC=objItem
Next

objConn.Provider="ADSDSOobject"
objConn.Open "Active Directory Provider"
objCmd.ActiveConnection=objConn
objCmd.Properties("Page Size") = 100
objCmd.Properties("asynchronous")= True
objCmd.Properties("Timeout") = 30
objCmd.Properties("Cache Results") = False
objCmd.CommandText=strQuery
	
' Run query
Set objRS=objCmd.Execute

' Locate user in AD via strADSPath
Do While Not objRS.EOF    
	strADsPath=objRS.Fields("ADsPath")
	Set objUser = GetObject(strADsPath)
	Exit do
	objRS.movenext
Loop

WScript.sleep 1 ' slow things down a bit

' Set user information
  
strName=objUser.get("givenName") & " " & objUser.get("sn")  
strTel=objUser.get("telephonenumber")

WriteLnIE (" ... complete")

Open in new window

Avatar of strivoli
strivoli
Flag of Italy image

Which is the IE version of the working XP box? Which is the IE version of the NON working 7 box? Thank you.
ASKER CERTIFIED SOLUTION
Avatar of ARampton
ARampton
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.