|
|
Still a vbs beginner and been struck with a major scripting task The script I need to write is as follows: 1. I need to prompt for a netbios name. When entered it will remove them from all the groups they are in in the Active Directory Member Of tab. 2.Once this is done then it will search the user's Attributes and find the Profile Path, Home Drive Path and Terminal Services Profile Path. Thiw will then delete these file's on the server's. 3. Once Deleted It will remove the Profile Paths, Home Drive Paths and Terminal Services Profile Path from within the Active Directory Attributes..
I have the first bit now but need help with the rest:
Const ForReading = 1 Const ADS_NAME_INITTYPE_GC = 3 Const ADS_NAME_TYPE_NT4 = 3 Const ADS_NAME_TYPE_1779 = 1 Const ADS_PROPERTY_DELETE = 4
strUser = InputBox("Enter User Name")
strDomain = "My Domain"
Set objTrans = CreateObject("NameTranslate")
objTrans.Init ADS_NAME_INITTYPE_GC, ""
objTrans.Set ADS_NAME_TYPE_NT4, strDomain & "\" & strUser
strUserDN = objTrans.Get(ADS_NAME_TYPE_1779)
Set objUser = GetObject("LDAP://" & strUserDN)
arrMemberOf = objUser.GetEx("memberOf")
For Each Group in arrMemberOf Set objGroup = GetObject("LDAP://" & Group) objGroup.PutEx ADS_PROPERTY_DELETE, _ "member", Array("strUserDN") objGroup.SetInfo
|
|
|