Logon Script - Map Network Drive (VI-VN)

Logon Script - Map Network Drive (VI-VN)

Map Network Drive hành động ánh xạ 1 share folder trên server thành 1 ổ đĩa trên máy client. Mục đích là giúp cho người sử dụng có thể truy cập những dữ liệu lưu trữ trên server một cách đơn giản hơn. Nhưng thông thường khi chúng thực hiện Map Network Drive  thì địa chỉ IP hoặc tên của server đều được hiển thị trên ổ đĩa.

Trong bài viết này chúng tôi sẽ trình bày cách thức sử dụng chức năng Logon Script của Group Policy Object (GPO) để Map Network Drive và cách thay đổi tên của các Network Drive để phù hợp với nhu cầu sử dụng của người dùng. 

 
 
Các bước thực hiện:

1. Tạo file Script

2. Tạo GPO và áp đặt cho hệ thống.

3. Kiểm tra.

Trong bài lab này tôi thực hiện trên 2 PC

      - 1 PC Windows Server 2008 R2 làm Domain Controller.

        - 1 PC Windows 7 đã join domain.

        - Tạo 1 user u1 để kiểm tra.

1. Tạo file Sctipt:

Trên DC tạo các thư mục sau :

 

Chia sẽ thư mục DATA cho Everyone Allow Full Control. Chúng ta dùng thư mục này để kiểm.

 

 
2. Tạo GPO và áp đặt cho hệ thống:

Tạo file đặt tên MapNetworkDrive.vbs, chuột phải chọn Edit.

 Nội dung file script như sau:

 ---------------------------------------------------------------------------------------------------------------------------------------------------------------
 ' NameDrive.vbs
' VBScript to map a network drive.
' ----------------------------------------'
'
Option Explicit
Dim objNetwork, strDrive, objShell, objUNC
Dim strRemotePath, strDriveLetter, strNewName
'
strDriveLetter = "W:"
strRemotePath = "\\dc01.msopenlab.local\data"
strNewName = "Reports"

' Section to map the network drive
Set objNetwork = CreateObject("WScript.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath

' Section which actually (re)names the Mapped Drive
Set objShell = CreateObject("Shell.Application")
objShell.NameSpace(strDriveLetter).Self.Name = strNewName

Wscript.Echo "Check : "& strDriveLetter & " for " & strNewName
WScript.Quit

' End of Example VBScript.
-------------------------------------------------------------------------------------------------------------------------------------------------------------- 

Bạn chỉnh sửa lại cho phù hợp với hệ thống mình:

strDriveLetter = "ổ đĩa:"

strRemotePath = "đường dẫn đến server và thư mục chia sẽ"

strNewName = "Tên hiển thị của ổ đĩa"

 

Mở Group Policy Management.

 Theo đường dẫn Forest: msopenlab.local > Domains > msopenlab.local > Group Policy Objects. Chuột phải chọn New.

 Khung Name đặt tên Map Network Drive, chọn OK.

 

 

 

 

 

 

 

Chọn vào GPO vừa tạo, chuột phải Edit…

Theo đường dẫn User Configuration > Policies > Windows Settings > Scritps (Logon/Logoff)

 
Chuột phải mục Logon chọn Properties.

 Hộp thoại Logon Properties chọn Add…

 Hộp thoại Add a Script chọn Browse…

 Copy file MapNetworkdrive.vbs vào đường dẫn măc định và chọn vào file MapNetworkDrive.vbs, sau đó chọn Open.

 

  Hộp thoại Add a Script chọn OK.

Hộp thoại Logon Properties OK. Đóng màn hình Group Policy Management Editor.

Chọn vào domain msopenlab.local , chuột phải chọn Link an Existing GPO…

Chọn vào GOP Map Network Drive, chọn OK.

 Cập nhật Policy. Chọn Start , chọn RUN nhập vào CMD. Chọn OK.

Màn hình Commend-line nhập vào gpupdate /force.

3. Kiểm tra:

Đăng nhập vào tài khoản u1. Mở Computer kiểm tra thấy tên và đường dẫn của ổ đĩa mạng đã được thay đổi.

Leave a Comment
  • Please add 3 and 5 and type the answer here:
  • Post
Wiki - Revision Comment List(Revision Comment)
Sort by: Published Date | Most Recent | Most Useful
Comments
  • Patris_70 edited Original. Comment: added vi-VN Tags

Page 1 of 1 (1 items)
Wikis - Comment List
Sort by: Published Date | Most Recent | Most Useful
Posting comments is temporarily disabled until 10:00am PST on Saturday, December 14th. Thank you for your patience.
Comments
  • Patris_70 edited Original. Comment: added vi-VN Tags

Page 1 of 1 (1 items)