Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing a value in a user object within AD

Status
Not open for further replies.

RPLEng

Programmer
Dec 5, 2002
2
GB
The following script reads a value in the AD which is okay.

Set adsSystemInfo = CreateObject("ADSystemInfo")
Set User = getobject("LDAP://OU=Users,DC=mydomain,DC=com")
strCurrentDrive = User.HomeDrive
strCurrentDrivePath = User.HomeDirectory
User.SetInfo

The following code updates an existing value and this works.

Set adsSystemInfo = CreateObject("ADSystemInfo")
Set User = getobject("LDAP://OU=Users,DC=mydomain,DC=com")
User.HomeDrive = "H:"
User.HomeDirectory = "\\server\user\fred"
User.SetInfo

The following code generates the error indictated at the bottom. It seems I cannot blank an entry in the AD. Any ideas how I can achieve this ?

Set adsSystemInfo = CreateObject("ADSystemInfo")
Set User = getobject("LDAP://OU=Users,DC=mydomain,DC=com")
User.HomeDrive = empty
User.HomeDirectory = empty
User.SetInfo

ERROR : Unspecified error
Code: 80004005
Source: (Null)


Thanks in advance.

Rich
 
have you tried

User.HomeDrive = ""
User.HomeDirectory = ""
User.SetInfo

it may not like 'empty'
 

Nope. If I use the following then it appears to work but the AD does not accept the change and continues to connect to the old home drive.

User.HomeDrive = " "
User.HomeDirectory = " "
User.SetInfo



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top