#92232 - 2003-06-23 07:09 AM
How do you create blank fields with ADSI on AD
|
NTDOC
Administrator
   
Registered: 2000-07-28
Posts: 11628
Loc: CA
|
I ran accross this the other day and so far have not found a solution. I'm sure it can easily be done once you know the correct syntax or method.
I had a lot of accounts in the Active Directory that had some invalid data on their ProfilePath
It is easy to query or update data on the Active Directory, but I could not figure out how to delete the entry and leave it blank.
Example:
$UserGroup = GetObject('LDAP://etc...')
for each $user in $UserGroup
if $user.class = "user"
if NOT $user.profilePath =""
? 'Profile path for '+$user.name+ 'is not blank - it is: '+$user.profilepath
$user.profilePath=""
$user.SetInfo
endif
endif
next
|
The user profile will not be set to blank.
I can run this code and it works fine.
$UserGroup = GetObject('LDAP://etc...')
for each $user in $UserGroup
if $user.class = "user"
if NOT $user.profilePath =""
? 'Profile path for '+$user.name+ 'is not blank - it is: '+$user.profilepath
$user.profilePath="Anything I want it to be except BLANK"
$user.SetInfo
endif
endif
next
|
I found this to be true for other fields as well, which leads me to believe that there must be some special syntax, or method to accomplish a BLANK entry or Delete (without replacing) and entry.
You can create/delete to have a BLANK entry with the GUI tools, so I know it can be done.
Does anyone know the proper method to BLANK/DELETE an entry?
|
|
Top
|
|
|
|
Moderator: Shawn, ShaneEP, Ruud van Velsen, Arend_, Jochen, Radimus, Glenn Barnas, Allen, Mart
|
0 registered
and 874 anonymous users online.
|
|
|