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
Solved

Powershell script to reset user passwords in Windows and Linux

Posted on 2011-02-10
5
949 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
  • 3
  • 2
5 Comments
 
LVL 21

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 21

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 21

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

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
In-place Upgrading Dirsync to Azure AD Connect
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 from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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