Scripted change of own password.


hello,

i'm having 2 windows servers(a , b) not in domain, both running windows server 2008 r2. on server i'm logged in as  administrator. on server b have user account member of group users.  account on server b don't have enabled "prevent user changing password".

need able automatically(by script or c++\c# application) change password of user on server b server a.

limitations are:
- need avoid things opening rdp session , sending keystrokes.

- need avoid using 3rd part software(paid or opensource - know can use pspassword this).

i have tried via vbs script set ouser = opensdobject("winnt://b/username,user", "b\username", "oldpassword", 1)
when try change password via ouser.changepassword "newpassword" accessdenid method. in fact same error message can receive if "net user username *". it's coming fact, it's trying set password, not change it.

there way how can allow 1 user set it's own password or how make system change if user login via rdp , changed password via ctrl+alt+del -> change password?

thank help.

so here final update about issue/question:

  • it looks there no built-in tool in windows allow non-administrator user change it's own password on remote server except interactive session via rdp , user needs have rights login rdp(usually via remote dekstop users group membership).
  • there using smbpasswd(with parameters -r server -u user) tool samba package: https://www.samba.org/samba/docs/man/manpages/smbpasswd.8.html . can used in batch mode , work out of box on linux distributions. quite difficult compile under windows(at least me).
  • there big difference between resetting password , changing password:
    - reset password need member of administrators group. don't need know previous password. can bypass several limitations new password(minimal password age, password history). can reset password of account.
    - change password: don't need , specific security group. need know previous password. need meet password requirements. can change own password(in general, there possibility how change password account, still need know old password account).

here how achieved task:

  • created c++ project in vs - express edition.
  • downloaded 2 idl files: 
    ms-dtyp.idl - http://msdn.microsoft.com/en-us/library/cc230300.aspx
    ms-samr.idl - http://msdn.microsoft.com/en-us/library/cc245825.aspx
  • added idl files project , compiled them -> created .c file , .h file. i've added both files project , in main file included .h file.
  • in main file use wnetaddconnection2 - http://msdn.microsoft.com/en-us/library/windows/desktop/aa385413%28v=vs.85%29.aspx establish connection remote server(\\server\ipc$). needed validate credentials , establish communication later commands.
  • then use rpcstringbindingcompose formulate binding string. step not mandatory, makes things simpler.
  • then rpcbindingfromstringbinding create rpc handle, needed later.
  • then rpcepresolvebinding 2nd param equal samr_v1_0_c_ifspec
  • then per specification listed here: http://msdn.microsoft.com/en-us/library/cc245707.aspx prepare old , new password in required form.
  • use samroemchangepassworduser2 (opnum 54) change password.

i found valuable wireshark allowed me capture application sending on wires had possibility check if goes wrong.



Windows Server  >  Security



Comments

Popular posts from this blog

WIMMount (HSM) causing cluster storage to go redirected (2012r2 DC)

Failed to delete the test record dcdiag-test-record in zone test.com

Azure MFA with Azure AD and RDS