![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Frustrating ADSI Hello NG, Hello NG, i want to enable a user account. <snipp> $user = [ADSI]"LDAP://cn=testaccount,ou=testou,dc=test,dc=com" this fails $user.psbase.invokeset("AccountDisabled",$false) $user.psbase.commitchanges() Why does it fail? -- bye Stefan |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Frustrating ADSI $usr.userAccountControl=66050 # disable $usr.userAccountControl=66048 # enable $usr.setinfo() -- $hay http://scriptolog.blogspot.com "Stephan Winkler" <spamme@ifyoucan.de> wrote in message news:b4nus219nn32gecfb4k7rvpool4j3ip6ir@4ax.com... > Hello NG, > > Hello NG, > > i want to enable a user account. > > <snipp> > $user = [ADSI]"LDAP://cn=testaccount,ou=testou,dc=test,dc=com" > > this fails > > $user.psbase.invokeset("AccountDisabled",$false) > $user.psbase.commitchanges() > > Why does it fail? > > -- > bye > > Stefan |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Frustrating ADSI Hello, >$usr.userAccountControl=66050 # disable >$usr.userAccountControl=66048 # enable >$usr.setinfo() thanks for the hint but as i remember this attribute is cumulated and have a lot of values. Normally the value 512 is a normal user account and 514 disables it. I thougt i can use "AccountDisabled",$false to enable it. i solved it so: $user = new-object system.directoryservices.directoryentry("LDAP://cn=testaccount,ou=testou,dc=test,dc=com") $user.psbase.invokeset("accountdisabled",$false) $user.setinfo() but i dont understand why the commandline in my previous posting won´t work. :-( bye Stephan |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Frustrating ADSI I think the commitchanges() is the problem Can't really tell, I'm at home with no AD around -- $hay http://scriptolog.blogspot.com "Stephan Winkler" <spamme@ifyoucan.de> wrote in message news:s6pus2tn1eknbjtej2v5t5v7b4bpeq8mqr@4ax.com... > Hello, > >>$usr.userAccountControl=66050 # disable >>$usr.userAccountControl=66048 # enable >>$usr.setinfo() > > thanks for the hint but as i remember this attribute is cumulated and > have a lot of values. Normally the value 512 is a normal user account > and 514 disables it. I thougt i can use "AccountDisabled",$false to > enable it. > > i solved it so: > > $user = new-object > system.directoryservices.directoryentry("LDAP://cn=testaccount,ou=testou,dc=test,dc=com") > > $user.psbase.invokeset("accountdisabled",$false) > $user.setinfo() > > but i dont understand why the commandline in my previous posting won´t > work. :-( > > bye > > Stephan |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Frustrating ADSI Hello, On Sun, 11 Feb 2007 21:03:25 +0200, "$hay" <no@addre.ss> wrote: >I think the commitchanges() is the problem >Can't really tell, I'm at home with no AD around i tried it with $user.psbase.commitchanges() and with $user.setinfo(). On both versions i had the same behaviour. bye Stephan |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Frustrating ADSI Strange did work before http://mow001.blogspot.com/2006/07/p...ry-part-3.html PoSH>$user.InvokeGet('AccountDisabled') True PoSH>$user.userAccountControl 546 PoSH>$mow.invokeSet('Accountdisabled',$false) PoSH>$mow.CommitChanges() PoSH>$mow.userAccountControl 544 both methods should work, will do some testing here tomorow Greetings /\/\o\/\/ "$hay" <no@addre.ss> wrote in message news:Oc3bX9gTHHA.1228@TK2MSFTNGP06.phx.gbl... >I think the commitchanges() is the problem > Can't really tell, I'm at home with no AD around > > -- > $hay > http://scriptolog.blogspot.com > > > > "Stephan Winkler" <spamme@ifyoucan.de> wrote in message > news:s6pus2tn1eknbjtej2v5t5v7b4bpeq8mqr@4ax.com... >> Hello, >> >>>$usr.userAccountControl=66050 # disable >>>$usr.userAccountControl=66048 # enable >>>$usr.setinfo() >> >> thanks for the hint but as i remember this attribute is cumulated and >> have a lot of values. Normally the value 512 is a normal user account >> and 514 disables it. I thougt i can use "AccountDisabled",$false to >> enable it. >> >> i solved it so: >> >> $user = new-object >> system.directoryservices.directoryentry("LDAP://cn=testaccount,ou=testou,dc=test,dc=com") >> >> $user.psbase.invokeset("accountdisabled",$false) >> $user.setinfo() >> >> but i dont understand why the commandline in my previous posting won´t >> work. :-( >> >> bye >> >> Stephan > > |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Frustrating ADSI 66050 and 66048 also set the "Password Does Not Expire" flag. If you want to enable the account without setting the "password does not expire flag" use 512 and to disable use 514. gaurhoth "$hay" <no@addre.ss> wrote in message news:%23gRUvrgTHHA.3440@TK2MSFTNGP03.phx.gbl... > $usr.userAccountControl=66050 # disable > $usr.userAccountControl=66048 # enable > $usr.setinfo() > > > -- > $hay > http://scriptolog.blogspot.com > > > > "Stephan Winkler" <spamme@ifyoucan.de> wrote in message > news:b4nus219nn32gecfb4k7rvpool4j3ip6ir@4ax.com... >> Hello NG, >> >> Hello NG, >> >> i want to enable a user account. >> >> <snipp> >> $user = [ADSI]"LDAP://cn=testaccount,ou=testou,dc=test,dc=com" >> >> this fails >> >> $user.psbase.invokeset("AccountDisabled",$false) >> $user.psbase.commitchanges() >> >> Why does it fail? >> >> -- >> bye >> >> Stefan > > |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Frustrating ADSI If you use the [ADSI] constructor then you get access to the COM methods rather than the .net methods in which case you need to use SetInfo rather than CommitChange() -- all very confusing Using psbase gets access to the underlying objects's methods -- Richard Siddaway Please note that all scripts are supplied "as is" and with no warranty Blog: http://richardsiddaway.spaces.live.com/ PowerShell User Group: http://www.get-psuguk.org.uk "$hay" wrote: > I think the commitchanges() is the problem > Can't really tell, I'm at home with no AD around > > -- > $hay > http://scriptolog.blogspot.com > > > > "Stephan Winkler" <spamme@ifyoucan.de> wrote in message > news:s6pus2tn1eknbjtej2v5t5v7b4bpeq8mqr@4ax.com... > > Hello, > > > >>$usr.userAccountControl=66050 # disable > >>$usr.userAccountControl=66048 # enable > >>$usr.setinfo() > > > > thanks for the hint but as i remember this attribute is cumulated and > > have a lot of values. Normally the value 512 is a normal user account > > and 514 disables it. I thougt i can use "AccountDisabled",$false to > > enable it. > > > > i solved it so: > > > > $user = new-object > > system.directoryservices.directoryentry("LDAP://cn=testaccount,ou=testou,dc=test,dc=com") > > > > $user.psbase.invokeset("accountdisabled",$false) > > $user.setinfo() > > > > but i dont understand why the commandline in my previous posting won´t > > work. :-( > > > > bye > > > > Stephan > > > |
My System Specs![]() |
| | #9 (permalink) |
| | Re: Frustrating ADSI wouldn't a better solution be to get the current value, use boolean operations to set or reset bit 2, and then store the result back? /Al "Gaurhoth" <gaurhoth@live.com> wrote in message news:A0680645-1453-4453-8B93-C3F85B8E2E31@microsoft.com... > 66050 and 66048 also set the "Password Does Not Expire" flag. > > If you want to enable the account without setting the "password does not > expire flag" use 512 and to disable use 514. > > gaurhoth > > "$hay" <no@addre.ss> wrote in message > news:%23gRUvrgTHHA.3440@TK2MSFTNGP03.phx.gbl... > > $usr.userAccountControl=66050 # disable > > $usr.userAccountControl=66048 # enable > > $usr.setinfo() > > > > > > -- > > $hay > > http://scriptolog.blogspot.com > > > > > > > > "Stephan Winkler" <spamme@ifyoucan.de> wrote in message > > news:b4nus219nn32gecfb4k7rvpool4j3ip6ir@4ax.com... > >> Hello NG, > >> > >> Hello NG, > >> > >> i want to enable a user account. > >> > >> <snipp> > >> $user = [ADSI]"LDAP://cn=testaccount,ou=testou,dc=test,dc=com" > >> > >> this fails > >> > >> $user.psbase.invokeset("AccountDisabled",$false) > >> $user.psbase.commitchanges() > >> > >> Why does it fail? > >> > >> -- > >> bye > >> > >> Stefan > > > > > |
My System Specs![]() |
| | #10 (permalink) |
| | Re: Frustrating ADSI Of course you are right. I'm generally only setting the UserAccountControl value on new accounts I've created, so that didn't occur to me. gaurhoth "Al Dunbar [MS-MVP]" <alan-no-drub-spam@hotmail.com> wrote in message news:OHBOeGjTHHA.5016@TK2MSFTNGP05.phx.gbl... > wouldn't a better solution be to get the current value, use boolean > operations to set or reset bit 2, and then store the result back? > > /Al > > "Gaurhoth" <gaurhoth@live.com> wrote in message > news:A0680645-1453-4453-8B93-C3F85B8E2E31@microsoft.com... >> 66050 and 66048 also set the "Password Does Not Expire" flag. >> >> If you want to enable the account without setting the "password does not >> expire flag" use 512 and to disable use 514. >> >> gaurhoth >> >> "$hay" <no@addre.ss> wrote in message >> news:%23gRUvrgTHHA.3440@TK2MSFTNGP03.phx.gbl... >> > $usr.userAccountControl=66050 # disable >> > $usr.userAccountControl=66048 # enable >> > $usr.setinfo() >> > >> > >> > -- >> > $hay >> > http://scriptolog.blogspot.com >> > >> > >> > >> > "Stephan Winkler" <spamme@ifyoucan.de> wrote in message >> > news:b4nus219nn32gecfb4k7rvpool4j3ip6ir@4ax.com... >> >> Hello NG, >> >> >> >> Hello NG, >> >> >> >> i want to enable a user account. >> >> >> >> <snipp> >> >> $user = [ADSI]"LDAP://cn=testaccount,ou=testou,dc=test,dc=com" >> >> >> >> this fails >> >> >> >> $user.psbase.invokeset("AccountDisabled",$false) >> >> $user.psbase.commitchanges() >> >> >> >> Why does it fail? >> >> >> >> -- >> >> bye >> >> >> >> Stefan >> > >> > >> > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Frustrating time with WLM | Live Mail | |||
| So frustrating | Chillout Room | |||
| Frustrating time trying to sign in here | Vista security | |||
| Please Help!!!! Vista Permissions very frustrating! | Vista security | |||
| THAT FRUSTRATING RED X | Vista networking & sharing | |||