Advertisement

09.17.2007 at 04:05AM PDT, ID: 22832807
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.6

VBS Script not running on Vista

Asked by bheroniphr in Windows Vista, Windows XP Operating System, VB Script

Tags: , , ,

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.

.NET 1.1/2.0/3.0 are ALL installed.

I have ensured that VBScript is a registered service with C:\>regsvr32 vbscript.dll.

I have also tried running the script manually from Command Line as such C:\>cscript mapped_drives.vbs but this did nothing.

(both of these were done under an Admin Command Line)

I'm pretty sure from this that it is something in the script that is preventing Vista from running it.

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.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
     objMail.Configuration.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/smtpserver") _
          = MAIL_SERVER
     objMail.Configuration.Fields.Item _
          ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") _
          = 25
     objMail.Configuration.Fields.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.Network")
Set wshShell = CreateObject("WScript.Shell")
Set objFileSystem = CreateObject("Scripting.FileSystemObject")




'
'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 IfStart Free Trial
[+][-]09.18.2007 at 08:05PM PDT, ID: 19918103

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 10:32AM PDT, ID: 20015983

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.04.2007 at 04:17PM PDT, ID: 20018633

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.05.2007 at 10:39AM PDT, ID: 20023900

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Windows Vista, Windows XP Operating System, VB Script
Tags: vista, vbs, script, running
Sign Up Now!
Solution Provided By: RoelandK
Participating Experts: 2
Solution Grade: A
 
 
[+][-]10.07.2007 at 04:28PM PDT, ID: 20031350

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_1_20070628