做过在客户端修改服务器的组件,你看看
'***** *****ÒÔÏÂÓÃÓÚÐÞ¸ÄÓû§ÃÜÂë***** *****
Private Declare Function NetUserChangePassword Lib "NETAPI32.DLL" _
(ByVal domainname As String, _
ByVal username As String, _
ByVal oldpassword As String, _
ByVal newpassword As String) As Long
Private Declare Function NetUserSetInfo Lib "NETAPI32.DLL" _
(ByVal servername As String, _
ByVal username As String, _
ByVal Level As Long, _
UserInfo As Any, _
ParmError As Long) As Long
Private Type USER_INFO_1003
usri1003_password As Long
End Type
Public Function ChangeUserPassword(ByVal strUserName As String, ByVal strOldPassword As String, ByVal strNewPassword As String) As String
Dim lngWin32apiResultCode As Long
Dim strServerName As String
Dim udtUserInfo1003 As USER_INFO_1003
Dim lngParmErr As Long
Dim msg As String
lngWin32apiResultCode = NetUserChangePassword(strServerName, _
strUserName, _
strOldPassword, _
strNewPassword)
End If
Select Case lngWin32apiResultCode
Case ERROR_ACCESS_DENIED: msg = "Error: Access denied."
Case ERROR_INVALID_PASSWORD: msg = "Error: Invalid password."
Case NERR_InvalidComputer: msg = "Error: Invalid Computer-/Domainname."
Case NERR_NotPrimary: msg = "Error: This operation can only performed on the primary domain controler."
Case NERR_UserNotFound: msg = "Error: User not found."
Case NERR_PasswordTooShort: msg = "Error: Password does not match Password-Restrictions. (Password to short, to long or has already been used by this user.)"
Case ERROR_CANT_ACCESS_DOMAIN_INFO
msg = "Error: Error accessing info for domain controler. Maybe the computer is not available or access was denied."
Case 0: msg = "Operation performed successfully."
Case Else: msg = "Error: Unexpected Error " & Err.Description & " occured."
End Select
ChangeUserPassword = msg
End Function
'
'
'Public Function DOSChangePwd(ByVal strUserName As String, ByVal strNewPassword As String) As Boolean
'Dim IsSuccess
'Dim oScript As Object
'
''On Error Resume Next
'Set oScript = CreateObject("WSCRIPT.SHELL")
'
'IsSuccess = oScript.Run("cmd.exe /c net user " & strUserName & " " & strNewPassword, 0, True)
'If IsSuccess <> 0 Then
' DOSChangePwd = False
'Else
' DOSChangePwd = True
'End If
'Set oScript = Nothing
'End Function