troubleshooting Question

Logon script not working with windows 7

Avatar of wra-tech
wra-tech asked on
VB ScriptWindows 7
8 Comments1 Solution485 ViewsLast Modified:
We use a log on script to map dives for users based on AD group membership.  This is done via user profile not group policy.  The script has worked flawlessly until now.  We added our first windows 7 machines and the script runs but no drive are mapped.  I've read about two tkens and stuff but haven't found a solution.  We do not script a lot so that is not a skill set on staff.  Is there away to edit our current script or does someone have canned script that they are willing to share that i can edit to fit our Domain  Thanks everyone in advance for any help.

On Error Resume Next
Dim WshNetwork, asdPath, User
Dim strMappedDrives, strStatus
Dim IE

Const ADS_READONLY_SERVER = 4
 
' Display IE status window

Call CreateIE()
strStatus = "Logon Script v1.0 " & 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://CAMPUS/" & strUser
  Set dso = GetObject("WinNT:")
  Set objUser = dso.OpenDSObject(adsPath,"","", ADS_READONLY_SERVER)
  For Each Prop In objUser.groups
    Select Case Prop.Name

        Case "Technology GG"
          Call Division1()

        Case "Senior Systems"
          Call Division2()
            
        Case "Library GG"
          Call Division3()
      
        Case "Archives GG"
          Call Division4()

      Case "Business GG"
          Call Division5()

      Case "Medical GG"
        Call Division6()

      Case "Alumni GG"
        Call Division7()

      Case "Athletics GG"
        Call Division8()

      Case "Guidance GG"
        Call Division9()

      Case "Faculty GG"
        Call Division10 ()

      Case "Music GG"
        Call Division11 ()
      
      Case "Registrar GG"
        Call Division12()

        Case "Deans GG"
        Call Division13()

      Case "Admissions GG"
        Call Division14()    

      Case "Hardscrabble GG"
        Call Division15()
      
      Case "Publications Read Only GG"
        Call Division16()

      Case "Publications GG"
        Call Division17()
      
      Case "AutoCad GG"
        Call Division18()

      Case "HR GG"
        Call Division19()

      Case "Maintenance GG"
        Call Division20()
   
      Case "Record GG"
        Call Division21()
      
      Case "History GG"
        Call Division23()

      Case "Languages GG"
        Call Division25()

      Case "Head GG"
        Call Division26()

      Case "Biology GG"
        Call Division27()

      Case "Web GG"
        Call Division28()

        Case "AdminPlanning GG"
          Call Division29()

      Case "FacultyDatabase GG"
        Call Division30()


      'etc
    End Select
  Next 'Prop
      
End Sub

Sub Division1()

  strStatus = strStatus & vbCRLF & "Member of Technology GG..."
  ie.document.all.wstatus.InnerText = strStatus
 
  MapDrive "T:", "\\1-wra-techstore\tech"


End Sub


Sub Division2()

strStatus = strStatus & vbCRLF & "Member of Senior Systems..."
  ie.document.all.wstatus.InnerText = strStatus

  MapDrive "S:", "\\w-nas\Senior"      

End Sub

Sub Division3()
strStatus = strStatus & vbCRLF & "Member of Library..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "T:", "\\w-nas\Library"

End Sub

Sub Division4()
strStatus = strStatus & vbCRLF & "Member of Archives..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "Y:", "\\w-nas\Archives"

End Sub


Sub Division5()
strStatus = strStatus & vbCRLF & "Member of Business & Finance..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "N:", "\\w-nas\Business"


End Sub

Sub Division6()
strStatus = strStatus & vbCRLF & "Member of Medical & Health..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "K:", "\\w-nas\HealthCenter"


End Sub




Sub Division7()
strStatus = strStatus & vbCRLF & "Member of Alumni & Development..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "F:", "\\w-nas\Alumni"


End Sub




Sub Division8()
strStatus = strStatus & vbCRLF & "Member of Athletics..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "M:", "\\w-nas\Athletics"


End Sub


Sub Division9()
strStatus = strStatus & vbCRLF & "Member of Guidance..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "O:", "\\w-nas\Guidance"


End Sub


Sub Division10()
strStatus = strStatus & vbCRLF & "Member of Faculty..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "P:", "\\w-nas\FacultyEvalForms"

End Sub


Sub Division11()
strStatus = strStatus & vbCRLF & "Member of Music..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "M:", "\\w-nas\MusicDepartment"

End Sub



Sub Division12()
strStatus = strStatus & vbCRLF & "Member of Registrar..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "R:", "\\w-nas\Studies"


End Sub





Sub Division13()
strStatus = strStatus & vbCRLF & "Member of Deans..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "Q:", "\\w-nas\Deans"


End Sub





Sub Division14()
strStatus = strStatus & vbCRLF & "Member of Admissions..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "L:", "\\w-nas\Admissions"


End Sub



Sub Division15()
strStatus = strStatus & vbCRLF & "Member of Hardscrabble..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "H:", "\\w-nas\HardScrabble"


End Sub



Sub Division16()
strStatus = strStatus & vbCRLF & "Member of Publications Read Only..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "Q:", "\\w-nas\Publications"


End Sub




Sub Division17()
strStatus = strStatus & vbCRLF & "Member of Publications..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "Q:", "\\w-nas\Publications"


End Sub



Sub Division18()
strStatus = strStatus & vbCRLF & "Member of AutoCAD..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "X:", "\\w-nas\AutoCad"


End Sub



Sub Division19()
strStatus = strStatus & vbCRLF & "Member of Human Resources..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "H:", "\\w-nas\Human Resources"


End Sub



Sub Division20()
strStatus = strStatus & vbCRLF & "Member of Maintenance & Security..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "X:", "\\w-nas\Maintenance"


End Sub



Sub Division21()
strStatus = strStatus & vbCRLF & "Member Reserve Record..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "R:", "\\w-nas\Record" & User      


End Sub



Sub Division23()
strStatus = strStatus & vbCRLF & "Member of History..."
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "H:", "\\w-nas\History"


End Sub



Sub Division25()
strStatus = strStatus & vbCRLF & "Member of Languages"
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "L:", "\\w-nas\Languages"


End Sub


Sub Division26()
strStatus = strStatus & vbCRLF & "Member of Headmaster"
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "W:", "\\w-nas\Headmaster"


End Sub

Sub Division27()
strStatus = strStatus & vbCRLF & "Member of Biology Department"
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "Y:", "\\w-nas\Biology"


End Sub

Sub Division28()
strStatus = strStatus & vbCRLF & "Member of Web Services"
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "W:", "\\w-nas\Web"


End Sub

Sub Division29()
strStatus = strStatus & vbCRLF & "Member of Admin Planning"
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "O:", "\\w-nas\AdminPlanning"


End Sub

Sub Division30()
strStatus = strStatus & vbCRLF & "Member of Faculty Database"
  ie.document.all.wstatus.InnerText = strStatus

      MapDrive "X:", "\\w-nas\FacultyDatabases"


End Sub


Sub CreateIE()

  On Error Resume Next
  Set IE = CreateObject("InternetExplorer.Application")
  With IE
    .navigate "\\w-doug\netlogon\logon.htm"
    .resizable=0
    .height=380
    .width=350
    .menubar=0
    .toolbar=0
    .statusBar=0
    .visible=1
  End With
  Do while ie.Busy
    ' wait for page to load
    Wscript.Sleep 100
  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


 
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros