Solved

Powershell script to reset user passwords in Windows and Linux

Posted on 2011-02-10
5
951 Views
Last Modified: 2012-05-11
Experts,

       We have a configuration of MS AD and Linux authenticating using Samba, Winbind with PAM and NSS all configured on our network. What capabilities does this give me with managing Linux user accounts with AD? I read an article that discusses the authentication to AD using Winbind however Group policy is not available - as of yet. Does this mean I cannot have a Powershell script to reset user passwords on XP boxes and Linux boxes? What are the capabilities of administration on this setup?

THanks, Missymadi
0
Comment
Question by:missymadi
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 22

Expert Comment

by:dan_blagut
ID: 34869598
Hello

Well I resolved a situation like this on the other side.
We started with an LDAP and we made the syncro with AD. All users change the passwords using a web page that do both changes (in LDAP and AD)
You can modify the page to allow a your desk support to change the passwords.

Dan
0
 

Author Comment

by:missymadi
ID: 34872117
Could I have a little more information on how you accomplished this issue? Maybe some steps to follow to achieve the password sync?
0
 
LVL 22

Expert Comment

by:dan_blagut
ID: 34872454
Well the users use a php page that do the change in LDAP. In that page we aded one line of code that launch a vbs script on a ssh server. In the parameters of the vbs on put the user name and the password.
On the Windows controller we implemented an ssh server that accept certificate authentication. That allow to execute the vbs as administrator without password and deny all other connexions.
Like that the password is sent using a secure way (ssh cripted channel).
On the AD users can't change the password and we deactivated all tests on the passwords, except the expiration timeout. But when the password is expired, the user must call tech support.
If you need the vbs script I can send it to you, but is a basic password change script.
And we also keeped all user management on the LDAP side (site changes, passwords changes, user creation and user deletion)

Dan
0
 

Author Comment

by:missymadi
ID: 34874452
Yes, could you please forward the script.

Thank you,
Missymadi
0
 
LVL 22

Accepted Solution

by:
dan_blagut earned 500 total points
ID: 34877373
You have here the scripts:

the target domain is : domain.local
the first password for a new user is P@ssw0rd

Dan

'Change password

Set objArgs = WScript.Arguments
' parametres: 0Site 1LastName 2FirstName 3passwd 
longname="cn="&objArgs(2)&" "&objArgs(1)
Set objUser = GetObject _
 ("LDAP://"&longname&",ou=Users,ou="&objArgs(0)&",dc=domain,dc=local")
objUser.SetPassword objArgs(3)

WScript.quit

'delete user



Set objArgs = WScript.Arguments
' parametres: 0Site 1LastName 2FirstName 3uid 4e-mail 
longname="cn="&objArgs(2)&" "&objArgs(1)
Set objOU = GetObject("LDAP://OU=Users,OU="&objArgs(0)&",dc=domain,dc=local")
objOU.Delete "User", longname

WScript.quit

'create user



Set objArgs = WScript.Arguments
' parametres: 0Site 1LastName 2FirstName 3uid 4e-mail 
longname="cn="&objArgs(2)&" "&objArgs(1)

Set objOU = GetObject("LDAP://OU=Users,OU="&objArgs(0)&",dc=domain,dc=local")
Set objUser = objOU.Create("User", longname)
objUser.Put "sAMAccountName", objArgs(3)
objUser.Put "mail", objArgs(4)
objUser.Put "physicalDeliveryOfficeName",objArgs(0)
objUser.SetInfo

objUser.SetPassword "P@ssw0rd"
objUser.AccountDisabled = False

objUser.SetInfo



WScript.quit

Open in new window

0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

735 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question