WSH Logon Script for mapping user network drive
来源:互联网 发布:神经网络理论知乎 编辑:程序博客网 时间:2024/04/30 01:34
'-----------------------------------------------------------------------
'WSH Logon Script for mapping user network drive
'-----------------------------------------------------------------------
'-----------------------------------------------------------------------
' Main
'Getting Each Group information of user and Call MapDRV function
'-----------------------------------------------------------------------
On Error Resume Next
Call ReNetDrive() 'Remove user pc all networkdrive
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set objUser = GetObject("WinNT://" & wshNetwork.UserDomain & "/" & WshNetwork.UserName & ",user")
For Each Group in objUser.Groups
'WScript.Echo Group.name
GRPName = UCase(Group.name)
If left(GRPName,4) = "_ORG" Or left(GRPName,4) = "_FNC" Then
WScript.Echo GRPName
Call MapDRV(GRPName)
End If
Next
Set objUser = nothing
Set WshNetwork = nothing
'Call RunWinauditu() 'Check hardware and software
'-------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------
'Map User's NetworkDrive
'-------------------------------------------------------
Function MapDRV(GRPName)
Set fso = CreateObject("Scripting.FileSystemObject")
LogonPath = fso.GetParentFolderName(WScript.ScriptFullName)
Set grplist = Fso.OpenTextFile(logonpath&"/GroupList.csv")
Do While Not grplist.AtEndOfLine
aGroup = Split(grplist.ReadLine,",")
'WScript.Echo aGroup(0)
If GRPName = aGroup(0) Then
WScript.Echo aGroup(0) & aGroup(1) & aGroup(2)
WshNetwork.MapNetworkDrive aGroup(1),aGroup(2)
End If
Loop
Set grplist = Nothing
Set fso = Nothing
End Function
'-------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------
'Remove all NetworkDrive
'-------------------------------------------------------
Sub ReNetDrive()
Set WshNetwork = WScript.CreateObject("WScript.Network")
'WshNetwork.MapNetworkDrive "Z:", "//wcdc2/acc_01"
Set oDrives = WshNetwork.EnumNetworkDrives
For i = 0 To oDrives.Count - 1 Step 2
If oDrives.Item(i)<>"" Then
WScript.Echo oDrives.Item(i) &","& oDrives.Item(i+1)
WshNetwork.RemoveNetworkDrive oDrives.Item(i), True, True
End If
Next
Set oDrives = Nothing
Set WshNetwork = Nothing
end sub
'--------------------------------------------------------------------------------------------------------------
'-------------------------------------------------------
'Run a program for Check hardware and software
'-------------------------------------------------------
Sub RunWinauditu()
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
Call wshShell.run("//172.16.1.10/winaudit/winauditu.exe /o=html /f=//172.16.1.10/winaudit/" & wshnetwork.computername & ".html /r=so",2,True)
Call wshShell.run("//172.16.1.10/winaudit/winauditu.exe /o=text /f=//172.16.1.10/winaudit/" & wshnetwork.computername & ".txt /r=so",2,True)
Set WshShell = Nothing
Set WshNetwork = nothing
End Sub
'--------------------------------------------------------------------------------------------------------------
WScript.quit
- WSH Logon Script for mapping user network drive
- windows xp logon script
- connect disconnect network drive
- map network drive issues
- QQ logon script (from yidabu)
- user script
- User Script
- user script
- 解决IIS中Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.
- SSIS package出错报login failed for user 'nt authority\anonymous logon'的解决办法
- Vista user account cannot logon
- Mounting Network Drive Ubuntu 8.04
- 如何强制Logon script被执行
- google drive for PC ?
- user * lacks CREATE SESSION privilege;logon denied
- user ... lacks CREATE SESSION privilege:logon denied
- User client windows logon basic data
- Hide a user from GDM Logon Window
- Topcoder_3_155
- Oracle网摘
- Topcoder_3_157
- linux 服务详解
- 纪念我死去的考研路
- WSH Logon Script for mapping user network drive
- NS2资料网站
- ffmpeg for MPEG2 TS
- News Digest Jan 15
- 铁道部谈09春运:有足够心理准备面对众怒
- 转一个vim配置
- Perl中的散列
- report rdlc 动态加载 数据源、参数
- MS09-001漏洞基本分析