问题描述
我有一个简单的脚本,可以根据组成员身份映射网络驱动器.
Hi, I have a simple script that maps network drives based on group membership.
脚本正在执行其应有的操作,但是在脚本运行时出现预期的'End'错误". (我在Windows启动文件夹中)
The script is doing what it should, but I get an "Expected 'End' Error when the script runs. (I have it in windows startup folder)
脚本如下:
--------------------------------------------------- -------------------------------------------
------------------------------------------------------------------------------------------
关于错误继续下一个
设置objSysInfo = CreateObject("ADSystemInfo")
设置objNetwork = CreateObject("Wscript.Network")
strUserPath ="LDAP://"; & objSysInfo.UserName
设置objUser = GetObject(strUserPath)
对于objUser.MemberOf
中的每个strGroup strGroupPath ="LDAP://"; & strGroup
设置objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
选择案例strGroupName
案例"Group1"
objNetwork.MapNetworkDrive"V:","\\ fs1 \ Group1Folder"
选择案例strGroupName
案例"Group2"
objNetwork.MapNetworkDrive"W:","\\ fs2 \ TaD $ \ Group2Folder"
选择案例strGroupName
案例"Group3"
objNetwork.MapNetworkDrive"X:","\\ fs3 \ Group3Folder"
WScript.Quit
On Error Resume Next
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
strUserPath = "LDAP://" & objSysInfo.UserName
Set objUser = GetObject(strUserPath)
For Each strGroup in objUser.MemberOf
strGroupPath = "LDAP://" & strGroup
Set objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
Select Case strGroupName
Case "Group1"
objNetwork.MapNetworkDrive "V:", "\\fs1\Group1Folder"
Select Case strGroupName
Case "Group2"
objNetwork.MapNetworkDrive "W:", "\\fs2\TaD$\Group2Folder"
Select Case strGroupName
Case "Group3"
objNetwork.MapNetworkDrive "X:", "\\fs3\Group3Folder"
WScript.Quit
--------------------------------------------------- -------------------------------------------
------------------------------------------------------------------------------------------
我对VB和脚本非常陌生.有人可以让我知道我在想什么吗?
I am very new to VB and scripting. Can someone let me know what I am missing?
谢谢
推荐答案
Select Case strGroupName
Case "Group1"
objNetwork.MapNetworkDrive "V:", "\\fs1\Group1Folder"
Select Case strGroupName
Case "Group2"
objNetwork.MapNetworkDrive "W:", "\\fs2\TaD
这篇关于运行VB脚本时预期为“结尾" 800A03F6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!