0

원격 컴퓨터의 사용자 계정에 대한 암호를 변경하려고합니다.원격 컴퓨터의 암호 변경 "현재 암호 = 비어 있음"사용자 계정

나는 이런 식으로 일을 해요 :

PrincipalContext context = new PrincipalContext(ContextType.Machine, "xxx.xxx.xxx.xxx" /*Remote machine IP address*/, "RemoteAdminUserName", "RemoteAdminPassword"); 
UserPrincipal user = (UserPrincipal.FindByIdentity(context, "RemoteAdminUserName")); 
user.SetPassword("RemoteAdminNewPassword"); 
user.Save(); 

이 코드는 올바르게 작동, 나는 빈 오래 된 암호를 사용하여 계정에 암호를 설정하려고 할 때를 제외하고. 이 경우 , 내가 처리되지 않은 메시지 = 액세스가 거부되었습니다 UserPrincipal.FindByIdentity

함께 System.Runtime.InteropServices.COMException에서 다음과 같은 예외를했다있다.

자료 = System.DirectoryServices ErrorCode가 = -2147024891 스택 트레이스 : System.DirectoryServices.DirectoryEntry.Bind()에서 System.DirectoryServices.DirectoryEntry.Bind (부울 throwIfFail) 에서 System.DirectoryServices.DirectoryEntry.RefreshCache에서() System.DirectoryServices.AccountManagement.PrincipalContext.get_QueryCtx()에서 System.DirectoryServices.AccountManagement.PrincipalContext.Initialize()에서 System.DirectoryServices.AccountManagement.PrincipalContext.DoMachineInit()에서 System.DirectoryServices.AccountManagement.Principal에서 .FindByIdentityWithTypeHelper (PrincipalContext conte) XT, 유형 principalType, Nullable`1 identityType, System.DirectoryServices.AccountManagement.UserPrincipal.FindByIdentity에서 문자열 identityValue, 날짜 시간 refDate) (PrincipalContext 상황, 문자열 identityValue) 의 InnerException :

이 PrincipalContext를 사용하는 몇 가지 제한이 비밀번호 보호 기능이없는 계정이 있습니까? 현재 암호가 설정되지 않은 원격 컴퓨터 사용자 계정에 대한 암호를 어떻게 설정할 수 있습니까?

답변

0

빈 암호가있는 계정에 원격으로 로그온하는 데 제한이 있습니다.

로컬로 스크립트를 실행하여 암호를 변경했지만 psexec를 사용하여 "로컬"스크립트를 실행할 수 있습니다.

솔루션 :

1) PsExec를 사용하여 원격 컴퓨터에서 스크립트를 실행 로컬 사용자

2)의 암호를 변경하는 스크립트를 작성 원격 컴퓨터 관리 사용자 계정이 있어야합니다

암호로 로그인하거나 원격으로 로그인 할 수 없습니다.

+0

감사합니다. 좋은 해결책입니다. 나는 다음 날에 그것을 시도 할 것이다. – Spaceman