473,406 Members | 2,217 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

changing admin password

BP
Can anyone point me to some C# code/info that would allow me to change the
Administrator password on a remote machine in a workgroup? Not a domain, no
Active Directory present. I realize I need to know the current password.
I've written code to extractall kinds of WMI info from these machines
remotely, so am familiar with the need to connect and authenticate. I've
even been successful importing the Netapi32.dll and using the
NetUserChangePassword call, however this seems to take 30 to 45 seconds per
machine to complete. I've seen VBScript to do the same, but would like to
control this within my C# pgm. Thanks
Nov 16 '05 #1
1 5863

"BP" <vz******@verizon.net> wrote in message
news:eB**************@TK2MSFTNGP09.phx.gbl...
Can anyone point me to some C# code/info that would allow me to change the
Administrator password on a remote machine in a workgroup? Not a domain,
no Active Directory present. I realize I need to know the current
password. I've written code to extractall kinds of WMI info from these
machines remotely, so am familiar with the need to connect and
authenticate. I've even been successful importing the Netapi32.dll and
using the NetUserChangePassword call, however this seems to take 30 to 45
seconds per machine to complete. I've seen VBScript to do the same, but
would like to control this within my C# pgm. Thanks


Not sure why NetUserChangePassword takes 30-45 seconds, but it looks like
you have a network problem.
You can use DirectoryServices (ADSI wrappers) namespace classes to manage
user accounts on remote system, note however that ADSI is using
NetUserChangePassword under the covers, so you will probably have the same
issue as calling NetUserChangePassword.

using System.DirectoryServices;
....

// bind to remote system using WinNT provider using user credentials with
sufficient privileges to execute a changepassword!
string userPath = "WinNT://machineName/administrator";
DirectoryEntry userEntry = new DirectoryEntry(userPath, "remoteadmin",
"pwd", AuthenticationTypes.Secure);
object[] password = new object[] {"oldpwd", "newpwd"};
object ret = userEntry.Invoke("ChangePassword", password );

userEntry.CommitChanges();

Willy.
Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Candice | last post by:
Please somebody help! I've deleted my admin username and password which was initially set at test. Now I can't log into my website as the administrator. How do I put Username and Password back so...
5
by: D E | last post by:
When using my web application manager (http://localhost:8080/admin) I forgot my password. Is there an XML file i can look at to remember/obtain (possibly even set). Thanks
4
by: ecPunk | last post by:
Hi, We have a web application where we want a user to be able to change his/her password if the password has expired but we are unable to do this with ASP (at the moment) because we can't log...
1
by: Kristen | last post by:
Hi, I'm not sure if this can be done or not but here goes... I write an application that uses Access and an MDW file to control who can open the database. Right now I have a bunch of different...
2
by: - Steve - | last post by:
I'm trying to change a user's password using objUser.Invoke("setPassword", "newpassword") It works fine as a console application if I'm logged in with someone with the correct permissions. If...
7
by: Luis Mendes | last post by:
Hello, I've a application in VB.NET that uses a connection to a Access data base stored in my Hard Drive. How can I change the location of the database (To a network) and change the conection...
1
by: VB Programmer | last post by:
Using ASP.NET 2.0 Web Site Admin Tool. Under Security tab it says this: Click a row to select a user and then click Edit user to view or change the user's password or other properties. When...
3
by: bmoore | last post by:
I am just beginning to implement user-level security in Access 2003. I created a user account and it is assigned to the users group. I would like to assign a password for this account (or for the...
2
by: JOHNSHELL08 | last post by:
Dear Team, There is a problem related to change ip address there in my network a domain admin user is exist and user knows its password and by this they are able to login with this...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.