请帮我两件事。
予。 执行此脚本时,文件夹正在创建如下:例如:“CN = Astra,OU = aaa,OU = bbb,OU = ccc,DC = ddd,DC = com” 但我只需要用Astra(CN)创建文件夹。
代码:
On Error Resume Next
Dim objFSO, objFolder
Set objGroup = GetObject _
("LDAP://cn=UserCreation,ou=aaa,ou=bbb,ou=ccc,dc=ddd,dc=com")
objGroup.GetInfo
arrMemberOf = objGroup.GetEx("member")
For Each strMember in arrMemberOf
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.CreateFolder(strMember)
Next
II。请帮我设置各个文件夹的用户权限。 用户来自AD小组。
谢谢!
答案 0 :(得分:0)
sFilterString = "CN=Astra,OU=aaa,OU=bbb,OU=ccc,DC=ddd,DC=com"
'here we break the string into an array of values:
' aJustCN(0) = "CN=Astra"
' aJustCN(1) = "OU=aaa"
' aJustCN(2) = "OU=bbb"
' ...
' aJustCN(5) = "OU=com"
aJustCN = Split(sFilterString)
'Here we just truncate the CN= from the string
sJustCN = Replace(aJustCN(0),"CN=","")
'This will return "Astra"
Wscript.Echo sJustCN