登录脚本自动主页目录文件夹创建与适当的权利 [英] Login Script Automated Home Directory Folder Creation with Appropriate Rights
问题描述
问候,
我不熟悉脚本,需要帮助创建一个登录脚本,一旦用户使用相应的权限登录后,将自动创建新用户的主目录拥有他们的文件夹的完全权限,没有其他人。我创建了一个名为
" Home"的隐藏共享。在D:Drive内并分配了 以下共享权限:
经过身份验证的用户:更改/读取
系统:完整
管理员:完整
文件夹安全权限如下:
经过身份验证的用户:阅读&执行 - 仅此文件夹
系统:完整 - 此文件夹,子文件夹和文件
管理员:此文件夹,子文件夹和文件
在我的AD中,我有这个OU路径下的用户:
公司 - >
英国 - >
          Aberdeen - >
                      用户
如何通过登录脚本登录并分配用户主文件夹后,如何自动创建用户主文件夹基于我创建的以下脚本对其配置文件文件夹的适当权限?此时,我必须手动创建每个单独的
文件夹,并授予单个用户对其文件夹的完全访问权限。如果我的AD中有大量用户,这可能会很乏味。预先感谢您的帮助!
On Error Resume Next
Dim objNet
Dim colDrives
Dim i
DIM sDefaultPrinter
设置objNet = WScript.Createobject(" Wscript.Network")
设置colDrives = objNet.EnumNetworkDrives
On Error Resume Next
如果colDrives.Count<> 0然后
对于i = 0至colDrives.Count - 1步骤2
objNet.RemoveNetworkDrive colDrives(i),true,true
下一个
结束如果
设置objNet = Nothing
设置colDrives = Nothing
设置objSysInfo = CreateObject(" ADSystemInfo")
设置objNetwork = CreateObject(" Wscript.Network")
strUserName = fnGetUserName()
strUserPath =" LDAP://" &安培; objSysInfo.UserName
设置objUser = GetObject(strUserPath)
对于objUser.MemberOf中的每个strGroup
strGroupPath =" LDAP://" &安培; strGroup
设置objGroup = GetObject(strGroupPath)
strGroupName = objGroup.CN
选择案例strGroupName
Case"Aberdeen Full Access Home"&
objNetwork.MapNetworkDrive" U:"," \\UKABZ03 \ Home $ \ " &安培; strUserName
结束选择
'''''''' """""""""""""""""""""""""""""""""""""""""""""""""" '''''''''
函数fnGetUserName()
''''''''''''''''''''' ''$'$ b Dim strUserName
Dim objNet
设置objNet = WScript.Createobject(" Wscript.Network")
'暂停脚本,直到用户登录为止
strUserName =""
请用
strUserName = objNet.UserName
循环直到strUserName<> ""
fnGetUserName = strUserName
设置objNet = Nothing
结束功能
van
您不需要脚本,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:
这篇关于登录脚本自动主页目录文件夹创建与适当的权利的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!