0

请帮我做两件事。

I. 执行此脚本时,文件夹会像这样创建,例如:“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

二、请帮我设置各个文件夹的用户权限。用户正在从 AD 组获取。

谢谢!

4

1 回答 1

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
于 2012-04-18T00:51:23.960 回答