Hi Guys, Thank for your reply on this matter. I have tried both methods but my login script runs but does not pause. Below is my script can anyone please see what is wrong with it?
Many thanks
On Error Resume Next
Dim WshNetwork, asdPath, User
Dim strMappedDrives, strStatus
Dim IE
set shell = createobject("wscript.shell")
shell.run ("net time \\atlas /set /yes")
Const ADS_READONLY_SERVER = 5
' Display IE status window
Call CreateIE()
strStatus = "Withers LLP London Login Script " & Date()
ie.document.all.wstatus.InnerText = strMsg3
' Get the User ID
Set WSHNetwork = WScript.CreateObject("WScript.Network")
strUser = ""
While strUser = ""
strUser = WSHNetwork.UserName
Wend
ie.document.all.Msg1.InnerText = strUser
call main()
strStatus = strStatus & vbCRLF & "Network Logon Complete..."
ie.document.all.wstatus.InnerText = strStatus
' Close IE status window
If not ie.document.all.holdit.checked then
ie.quit()
End if
' End of logon script
Public Sub Main()
'Main loop to detect group that user belongs to
adsPath = "WinNT://London/" & strUser
Set dso = GetObject("WinNT:")
Set objUser = dso.OpenDSObject(adsPath,"","", ADS_READONLY_SERVER)
For Each Prop In objUser.groups
Select Case Prop.Name
Case "Domain Users"
Call DomainUsers()
Case "Photos"
Call Photos()
Case "DigitalPhotos"
Call DigitalPhotos()
Case "Helpdesk"
Call Helpdesk()
Case "London Systems"
Call LondonSystems()
'etc
End Select
Next 'Prop
End Sub
Sub DomainUsers()
strStatus = strStatus & vbCRLF & "Member of Domain Users..."
ie.document.all.wstatus.InnerText = strStatus
MapDrive "S:", "\\poseidon\data"
MapDrive "V:", "\\poseidon\apps"
shell.run ("net use \\zeus\zenapps")
shell.run ("net use \\atlas\crispdata")
End Sub
Sub Photos()
strStatus = strStatus & vbCRLF & "Member of Hebe Photos Group..."
ie.document.all.wstatus.InnerText = strStatus
MapDrive "P:", "\\hebe\photos"
End Sub
Sub DigitalPhotos()
strStatus = strStatus & vbCRLF & "Member of Hebe JDM DigitalPhotos..."
ie.document.all.wstatus.InnerText = strStatus
MapDrive "Q:", "\\hebe\digitalphotos"
End Sub
Sub Helpdesk()
strStatus = strStatus & vbCRLF & "Member of Hyperion ITSTUFF..."
ie.document.all.wstatus.InnerText = strStatus
MapDrive "I:", "\\Hyperion\itstuff"
End Sub
Sub LondonSystems()
strStatus = strStatus & vbCRLF & "Member of London Systems Team..."
ie.document.all.wstatus.InnerText = strStatus
MapDrive "I:", "\\Hyperion\itstuff"
End Sub
Sub CreateIE()
On Error Resume Next
Set IE = CreateObject("InternetExplorer.Application")
With IE
.navigate "\\atlas\netlogon\uk\logon.htm"
.resizable=0
.height=470
.width=350
.menubar=0
.toolbar=0
.statusBar=0
.visible=1
End With
Do while ie.Busy
' wait for page to load
SecondsToDelay = "120"
Wscript.Sleep(SecondsToDelay *120)
Loop
End Sub
Sub MapDrive(strDrive,strShare)
On Error Resume Next
WSHNetwork.MapNetworkDrive strDrive, strShare
If Err.Number Then
WSHNetwork.RemoveNetworkDrive strDrive
WSHNetwork.MapNetworkDrive strDrive, strShare
End If
strMappedDrives = strMappedDrives & strDrive & " "
ie.document.all.Msg2.InnerText = strMappedDrives
End Sub