本帖最后由 小队长 于 2011-11-17 12:15 编辑
映射共享和在桌面建立快捷方式
- '映射共享和在桌面建立快捷方式 '登录(logon)脚本 'On Error Resume Next Set objNetwork = CreateObject("Wscript.Network") WScript.echo objNetwork.UserDomain Set objSysInfo = CreateObject("ADSystemInfo") strUserPath = "LDAP://" & objSysInfo.UserName Set objUser = GetObject(strUserPath) Dim WshShell Dim strDesktop Dim oShellLink1, oShellLink2, oShellLink3 Set WshShell = WScript.CreateObject("WScript.Shell") strDesktop = WshShell.SpecialFolders("Desktop") WScript.echo strUserPath 'strGroupPath = "LDAP://" & objUser.MemberOf For Each strGroup in objUser.MemberOf strGroupPath = "LDAP://" & strGroup Set objGroup = GetObject(strGroupPath) strGroupName = objGroup.CN WScript.echo strGroupName Select Case strGroupName Case "营销中心" objNetwork.MapNetworkDrive "X:", " \\fileserver\营销中心$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\营销中心共享组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "营销中心共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save Case "财务部" objNetwork.MapNetworkDrive "X:", " \\fileserver\财务部$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\财务部共享文件组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "财务部共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save Case "管理部" objNetwork.MapNetworkDrive "X:", " \\fileserver\管理部$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\管理部共享文件组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "管理部共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save Case "制造部" objNetwork.MapNetworkDrive "X:", " \\fileserver\制造部$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\制造部共享文件组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "制造部共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save Case "研发中心" objNetwork.MapNetworkDrive "X:", " \\fileserver\研发中心$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\研发中心共享文件组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "研发中心共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save Case "采购部" objNetwork.MapNetworkDrive "X:", " \\fileserver\采购部$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\采购部共享文件组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "采购部共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save Case "品质部" objNetwork.MapNetworkDrive "X:", " \\fileserver\品质部$" Set oShellLink1 = WshShell.CreateShortcut(strDesktop & "\品质部共享文件组.lnk") oShellLink1.TargetPath = "X:" oShellLink1.WindowStyle = 1 oShellLink1.Description = "品质部共享文件" oShellLink1.WorkingDirectory = "X:" oShellLink1.Save End Select
复制代码
|