Home All Groups Group Topic Archive Search About


Author
31 Oct 2007 12:43 PM
Milan
Can I reset log on to information (computers) by script?

Like Logon hours:
Const ADS_PROPERTY_CLEAR = 1

Set objUser = GetObject _
  ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")

objUser.PutEx ADS_PROPERTY_CLEAR, "logonHours", 0
objUser.SetInfo

Author
31 Oct 2007 1:18 PM
Richard Mueller [MVP]
Milan wrote:

> Can I reset log on to information (computers) by script?
>
> Like Logon hours:
> Const ADS_PROPERTY_CLEAR = 1
>
> Set objUser = GetObject _
>  ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")
>
> objUser.PutEx ADS_PROPERTY_CLEAR, "logonHours", 0
> objUser.SetInfo

That should work. I have to check if I have done it myself. Also, if that
doesn't work, I think you can assign 0, which has the same affect. VBScript
cannot assign any other values.

--
Richard Mueller
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net
--
Author
31 Oct 2007 1:36 PM
Milan
And property name for "Log On To" is?
objUser.PutEx ADS_PROPERTY_CLEAR, "logonto", 0

Show quote
"Richard Mueller [MVP]" wrote:

> Milan wrote:
>
> > Can I reset log on to information (computers) by script?
> >
> > Like Logon hours:
> > Const ADS_PROPERTY_CLEAR = 1
> >
> > Set objUser = GetObject _
> >  ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")
> >
> > objUser.PutEx ADS_PROPERTY_CLEAR, "logonHours", 0
> > objUser.SetInfo
>
> That should work. I have to check if I have done it myself. Also, if that
> doesn't work, I think you can assign 0, which has the same affect. VBScript
> cannot assign any other values.
>
> --
> Richard Mueller
> Microsoft MVP Scripting and ADSI
> Hilltop Lab - http://www.rlmueller.net
> --
>
>
>
Author
31 Oct 2007 1:58 PM
Milan
I found, that property name is
"userWorkstations"

Show quote
"Milan" wrote:

> And property name for "Log On To" is?
> objUser.PutEx ADS_PROPERTY_CLEAR, "logonto", 0
>
> "Richard Mueller [MVP]" wrote:
>
> > Milan wrote:
> >
> > > Can I reset log on to information (computers) by script?
> > >
> > > Like Logon hours:
> > > Const ADS_PROPERTY_CLEAR = 1
> > >
> > > Set objUser = GetObject _
> > >  ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")
> > >
> > > objUser.PutEx ADS_PROPERTY_CLEAR, "logonHours", 0
> > > objUser.SetInfo
> >
> > That should work. I have to check if I have done it myself. Also, if that
> > doesn't work, I think you can assign 0, which has the same affect. VBScript
> > cannot assign any other values.
> >
> > --
> > Richard Mueller
> > Microsoft MVP Scripting and ADSI
> > Hilltop Lab - http://www.rlmueller.net
> > --
> >
> >
> >
Author
31 Oct 2007 3:45 PM
Richard Mueller [MVP]
The logonHours attribute is binary (byte array). The userWorkstations
attribute is a multivalued string (no values, one value, or more than one).
I document most attributes of user objects in this link:

http://www.rlmueller.net/UserAttributes.htm

The first spreadsheet documents the attributes of user objects corresponding
to the fields on most of the tabs of the properties dialog of ADUC. The
second spreadsheet documents all attributes in a default installation of W2k
AD.

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

Show quote
"Milan" <Mi***@discussions.microsoft.com> wrote in message
news:F849F8B8-458D-4E6F-8BD3-035FFA24364F@microsoft.com...
>I found, that property name is
> "userWorkstations"
>
> "Milan" wrote:
>
>> And property name for "Log On To" is?
>> objUser.PutEx ADS_PROPERTY_CLEAR, "logonto", 0
>>
>> "Richard Mueller [MVP]" wrote:
>>
>> > Milan wrote:
>> >
>> > > Can I reset log on to information (computers) by script?
>> > >
>> > > Like Logon hours:
>> > > Const ADS_PROPERTY_CLEAR = 1
>> > >
>> > > Set objUser = GetObject _
>> > >  ("LDAP://cn=MyerKen,ou=Management,dc=NA,dc=fabrikam,dc=com")
>> > >
>> > > objUser.PutEx ADS_PROPERTY_CLEAR, "logonHours", 0
>> > > objUser.SetInfo
>> >
>> > That should work. I have to check if I have done it myself. Also, if
>> > that
>> > doesn't work, I think you can assign 0, which has the same affect.
>> > VBScript
>> > cannot assign any other values.
>> >
>> > --
>> > Richard Mueller
>> > Microsoft MVP Scripting and ADSI
>> > Hilltop Lab - http://www.rlmueller.net
>> > --
>> >
>> >
>> >

AddThis Social Bookmark Button