Hi,
I run a domain of ~50 nodes all on XP Pro. I have a GPO that runs a vbs script upon login to map various network drives. This works very nicely.
I have just put our first Vista system on the network and it doesn't want to map the drives. In case the script was using functions from .NET 1.1 or .NET 2.0 I have installed these but this has made no difference. The script is below.
Anyone got any ideas why it is not working?
Thanks
' Main Script for xxxx Drive Mappings
' 03/10/06 - Benjamin xxxx
' ben.xxx@domain.com
' --------------------------
----------
----------
----------
----------
----------
------
'
'Group Identification
'
Const IT_GROUP = "cn=it"
Const ANIMATION_GROUP = "cn=animation"
Const ART_GROUP = "cn=art"
Const AUDIO_GROUP = "cn=audio"
Const CODE_GROUP = "cn=code"
Const DESIGN_GROUP = "cn=design"
Const EXEC_GROUP = "cn=exec"
Const LEADS_GROUP = "cn=leads"
Const MANAGEMENT_GROUP = "cn=management"
Const PRODUCTION_GROUP = "cn=production"
Const RENDERS_GROUP = "cn=renders"
Const VFX_GROUP = "cn=vfx"
'
' Constants for Emailing Errors
'
Const MAIL_SERVER = "mailserver.domain.com"
Const TO_ADDRESS = "ben.xxxx@domain.com"
'
' Subroutines
'
Sub MapDrive(strDrive, strShare)
If objFileSystem.DriveExists(
strDrive) Then
strErrorMessage = strErrorMessage & "Failed to Map " & strDrive &_
" to " & strShare & ": Drive Exists" & VbCrLf
Exit Sub
End If
On Error Resume Next
Err.Clear
wshNetwork.MapNetworkDrive
strDrive, strShare
If Err.Number <> 0 Then
strErrorMessage = strErrorMessage & "Failed to Map " & strDrive &_
" to " & strShare & ": " & Err.Description & VbCrLf
End If
On Error Goto 0
End Sub
Sub SendMail(strTo, strBody)
Dim objMail
Set objMail = CreateObject("CDO.Message"
)
objMail.Subject = "Logon Script Errors, " + objUser.Get("displayName")
objMail.From = "LogonScriptErrors@domain.
com"
objMail.To = strTo
objMail.TextBody = strBody
objMail.Configuration.Fiel
ds.Item _
("
http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fiel
ds.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserver") _
= MAIL_SERVER
objMail.Configuration.Fiel
ds.Item _
("
http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
= 25
objMail.Configuration.Fiel
ds.Update
objMail.Send
Set objMail = Nothing
End Sub
'
'Main Code
'
Dim wshNetwork, wshShell
Dim objFileSystem, objADsysInfo, objUser
Dim strGroups, strErrorMessage
strErrorMessage = ""
Set wshNetwork = CreateObject("WScript.Netw
ork")
Set wshShell = CreateObject("WScript.Shel
l")
Set objFileSystem = CreateObject("Scripting.Fi
leSystemOb
ject")
'
'Drive Instructions
'
' Drive Mappings for everyone
MapDrive "B:", "\\fileserver\folder"
MapDrive "S:", "\\fileserver\folder"
MapDrive "T:", "\\DC\folder"
MapDrive "U:", "\\DC\folder"
MapDrive "V:", "\\DC\folder"
MapDrive "X:", "\\fileserver\folder"
MapDrive "y:", "\\fileserver\folder"
' Get the Group Membership and store it in strGroups
Set ADSysInfo = CreateObject("ADSystemInfo
")
Set objUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(join(objUser.GetEx("
MemberOf")
))
' Group Based Drive Mappings
If InStr(strGroups, ANIMATION_GROUP) Then
MapDrive "w:", "\\fileserver\folder"
MapDrive "M:", "\\fileserver\folder"
End If
If InStr(strGroups, AUDIO_GROUP) Then
MapDrive "w:", "\\fileserver\folder"
End If
If InStr(strGroups, ART_GROUP) Then
MapDrive "R:", "\\fileserver\folder"
End If
If InStr(strGroups, DESIGN_GROUP) Then
MapDrive "Z:", "\\fileserver\folder"
MapDrive "w:", "\\fileserver\folder"
End If
IF InStr(strGroups, EXEC_GROUP) Then
MapDrive "O:", "\\fileserver\folder"
MapDrive "Q:", "\\fileserver\folder"
End If
IF InStr(strGroups, LEADS_GROUP) Then
MapDrive "L:", "\\fileserver\folder"
End If
IF InStr(strGroups, PRODUCTION_GROUP) Then
MapDrive "K:", "\\fileserver\folder"
MapDrive "L:", "\\fileserver\folder"
End If
'
' Display the Errors if there are any
'
If strErrorMessage <> "" Then
strErrorMessage = "Errors encountered in the Login Script:" & vbCrLf & _
Replace(strErrorMessage, " Failed", vbCrLf & "Failed")
On Error Resume Next
strUserName = "" : strUserName = objUser.Get("displayName")
strComputerName = wshNetwork.ComputerName
On Error Goto 0
strErrorMessage = "User Name: " & strUserName & VbCrLf &_
"Computer Name: " & strComputerName & VbCrLf & VbCrLf &_
strErrorMessage & VbCrLf
SendMail TO_ADDRESS, strErrorMessage
End If
Start Free Trial