Change the password of Windows 2000 using VB.NET

zhaozj2021-02-16  44

First, you need to add a reference to System.directoryServices name space, and locate it to "Project -> Add reference)

->. Net-> System.directoryServices.dll ", add it. Below is the code section:

Dim MyString As String = "WinNT: //". System.Security.Principal.WindowsIdentity.GetCurrent () Name.Replace ( "/", "/") 'System.Security.Principal.WindowsIdentity.GetCurrent () Name. the resulting machine is the current user name, for example: MyComputerName / AdministratorDim MyDirectoryEntry as New DirectoryEntry (MyString) MyDirectoryEntry.Invoke ( "setPassword", "newpassword") 'modify the current user's password is "newPassword" MyDirectoryEntry.CommitChanges ()

转载请注明原文地址:https://www.9cbs.com/read-27366.html

New Post(0)