I want to test a password reminder script that runs at login.
I found this code for doing so:
Bind to user object in AD.
$User = [ADSI]:“LDAP://cn=Tom Lyczko,ou=NCMSO Users,dc=ncmso,dc=local”
Expire password immediately.
$User.pwdLastSet = 0
Save change in AD.
Problem is that PS throws an error on the ADSI line.
Unexpected token ‘:“LDAP://cn=Tom Lyczko,ou=NCMSO Users,dc=ncmso,dc=local”’ in expression or statement.
+ CategoryInfo : ParserError: ( , ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken
The original code line says:
$User = [ADSI]:“LDAP://cn=Jim Smith,ou=West,dc=MyDomain,dc=com”
It’s possible I could be doing something else wrong but I thought/hope someone could take a quick look at this??
I know I can test with group policy…but that is cumbersome etc.
Or maybe there is another way for me to get the specific user instead of this LDAP??
The specific user I want to test on is me BTW.
Thank you, Tom