Answered by:
UserPrincipal.ChangePassword is too slow

Question
-
Hi,
We are using the UserPrincipal.ChangePassword() method in our windows desktop application to change windows user password, but it is taking too long time (around 30 secs sometimes).
Is there any alternative for this?
One more Question:
Can an application use UserPrincipal.SetPassword without admin rights and no impersonate user.
please help me why the changepassword it too slow.
Monday, November 12, 2012 11:08 AM
Answers
-
Hi Sreelatha,
We have reviewed the questions further here. For the first question, it is possible that it will take time to do the operation given it is going to make a network call across to a domain controller for the operation to complete. Troubleshooting the delays is outside of what we can offer on the forum post but we could assist via a support case in doing network captures to provide feedback why the network call is taking time:
https://gettechsupport.microsoft.com/Default.aspx?pesid=14694
The underlying API call shows that this can be involved:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa746344(v=vs.85).aspx
For the second question, the SetPassword() operation does require higher permissions. An option is to possibly update the manifest to dictate what is needed by the application for installation:
http://msdn.microsoft.com/en-us/library/bb756929.aspx
Otherwise, the SetPassword method will throw an exception as defined:
Thanks,
Nathan
- Proposed as answer by Nathan ManisMicrosoft employee Wednesday, March 13, 2013 3:00 AM
- Marked as answer by Mike Feng Wednesday, March 13, 2013 6:23 AM
Wednesday, November 14, 2012 3:49 PM
All replies
-
Hi Sreelatha,
Welcome to the MSDN Forum.
I am trying to involve some other one in this thread.
Wait it patient, please.
Best regards,
Mike Feng
MSDN Community Support | Feedback to us
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Tuesday, November 13, 2012 8:18 AM -
Hi Sreelatha,
We have reviewed the questions further here. For the first question, it is possible that it will take time to do the operation given it is going to make a network call across to a domain controller for the operation to complete. Troubleshooting the delays is outside of what we can offer on the forum post but we could assist via a support case in doing network captures to provide feedback why the network call is taking time:
https://gettechsupport.microsoft.com/Default.aspx?pesid=14694
The underlying API call shows that this can be involved:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa746344(v=vs.85).aspx
For the second question, the SetPassword() operation does require higher permissions. An option is to possibly update the manifest to dictate what is needed by the application for installation:
http://msdn.microsoft.com/en-us/library/bb756929.aspx
Otherwise, the SetPassword method will throw an exception as defined:
Thanks,
Nathan
- Proposed as answer by Nathan ManisMicrosoft employee Wednesday, March 13, 2013 3:00 AM
- Marked as answer by Mike Feng Wednesday, March 13, 2013 6:23 AM
Wednesday, November 14, 2012 3:49 PM