更新时间:2023-09-25 17:49:58
您不需要脚本,AD会为您完成所有这些操作。举个例子,我刚创建了一个新的主文件夹:
Greetings,
I'm new to scripting and need help in creating a login script that will automatically create a new user's home directory once they login with the appropriate rights to have full privileges to their folder and no one else. I created a hidden share called "Home" within the D: Drive and assigned the following shared permissions:
Authenticated user : Change / Read
Systems: Full
Administrators: Full
The folder security permissions are as follows:
Authenticated Users: Read & Execute - This Folder Only
Systems: Full - This folder, sub folders and files
Administrators: This folder, sub folders and files
Within my AD, I have the users under this OU path:
Company-->
UK-->
Aberdeen-->
Users
How can I automate the creation of the user's home folders once they log in via the login script and assign the appropriate permissions to their profile folder based on the below script I have created? At this time, I have to manually create each individual folder and grant the individual user full access to their folder and nothing else. This can be tedious if I have a large pool of user within my AD. Thanks in advance for the help!
On Error Resume Next
Dim objNet
Dim colDrives
Dim i
DIM sDefaultPrinter
Set objNet = WScript.Createobject("Wscript.Network")
Set colDrives = objNet.EnumNetworkDrives
On Error Resume Next
If colDrives.Count <> 0 Then
For i = 0 To colDrives.Count - 1 Step 2
objNet.RemoveNetworkDrive colDrives(i),true,true
Next
End If
Set objNet = Nothing
Set colDrives = Nothing
Set objSysInfo = CreateObject("ADSystemInfo")
Set objNetwork = CreateObject("Wscript.Network")
strUserName = fnGetUserName()
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 "Aberdeen Full Access Home"
objNetwork.MapNetworkDrive "U:", "\\UKABZ03\Home$\" & strUserName
End Select
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Function fnGetUserName()
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim strUserName
Dim objNet
Set objNet = WScript.Createobject("Wscript.Network")
'Pause Script until User is Logged in
strUserName = ""
Do
strUserName = objNet.UserName
Loop Until strUserName <> ""
fnGetUserName = strUserName
Set objNet = Nothing
End Function
van
Hi,
You don't need a script, AD will do all of that for you. As an example, I just created myself a new home folder: