Solved

Powershell script to reset user passwords in Windows and Linux

Posted on 2011-02-10
5
947 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office 365 SSO and Shared Devices 6 41
Output objects to different columns 2 25
PowerShell select-object returns empty lines 3 17
Nano server Question 2 17
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
A brief introduction to what I consider to be the best editor for PowerShell.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now