I have a script that changes the computers which an user account can log on
to. The sample script below works fine. However I need to remove this
restriction from some users accounts an set back to "All Computers." So, how
can I do that? I have tried the following unsuccesfully. Any help is greatly
apprecciated.

objUser.userWorkstations = NULL



************* SCRIPT SAMPLE *************
Set objUser = GetObject(adsipath)
If Err.Number <> 0 Then 'Error should occur if the user does not exist
Wscript.Echo ErrorMsg
Err.Clear
Else
objUser.GetInfo
objUser.userWorkstations = "mycomputer"
objUser.SetInfo

Re: Set "Log On To The Following Computers" script by Richard

Richard
Thu Jun 15 00:18:07 CDT 2006

marcelovn wrote:

>I have a script that changes the computers which an user account can log on
> to. The sample script below works fine. However I need to remove this
> restriction from some users accounts an set back to "All Computers." So,
> how
> can I do that? I have tried the following unsuccesfully. Any help is
> greatly
> apprecciated.
>
> objUser.userWorkstations = NULL
>
>
>
> ************* SCRIPT SAMPLE *************
> Set objUser = GetObject(adsipath)
> If Err.Number <> 0 Then 'Error should occur if the user does not exist
> Wscript.Echo ErrorMsg
> Err.Clear
> Else
> objUser.GetInfo
> objUser.userWorkstations = "mycomputer"
> objUser.SetInfo

Hi,

You need to clear the attribute using the PutEx method. Use code similar to:

Const ADS_PROPERTY_CLEAR = 1
objUser.PutEx ADS_PROPERTY_CLEAR, "userWorkstations", 0
objUser.SetInfo

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net