Eugene Ovsienko
Eugene Ovsienko

Reputation: 11

How to Specify the Password to repadmin.exe via Remote PowerShell Session

I have some issues with repadmin.exe utility

I have the following setup:

  1. Windows Server 2012R2 with ADDS installed running inside of VMWare VM
  2. Windows 8.1 Pro (host for VMware, my home desktop). My host is NOT a part of the domain

I do the following:

  1. Open PowerShell ISE on my Windows 8.1 and establish remote connection to my DC (PowerShell ISE -> File -> New Remote PowerShell Tab)

  2. Once I`m connected remotely to DC I run the following command

    repadmin.exe /syncall

and get the following error:

CALLBACK MESSAGE: Error contacting server ad864315-1f78-4266-a7c2-2d6f9cde2f15._msdcs.arvo.local (network error): 5 (0x5):
    Access is denied.

CALLBACK MESSAGE: Error contacting server a5904e4b-dff2-4b75-b856-45593a48d84e._msdcs.arvo.local (network error): 5 (0x5):
    Access is denied.

SyncAll exited with fatal Win32 error: 8440 (0x20f8):
    The naming context specified for this replication operation is invalid.

I found here http://technet.microsoft.com/de-de/library/cc811552%28v=ws.10%29.aspx that is is possible to specify username and password for repadmin using /u: and /pw: keys. Besides it is possible to pass the password using 2 methods - either specify it explicitly in command line or put * (asterisks) and I will be prompted to enter the password. The second option is more preferable.

So I can do ether this way (specify the password in command line):

repadmin.exe /u:domain_name\user_name /pw:p@ssw0rd /syncall

or use asterisks and enter password after this command:

repadmin.exe /u:domain_name\user_name /pw:* /syncall

Asterisks works locally in PowerShell on the server, but if I run it using Remote PowerShell Session, I get the following error:

repadmin : Password: Failed to query the console mode.
    + CategoryInfo          : NotSpecified: (Password: Faile...e console mode.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

Is there any workaround? I would not specify the password clearly in command line as it is not secure.

Thanks!

Upvotes: 1

Views: 2328

Answers (1)

Morgan
Morgan

Reputation: 1

You might try something like this inside the remote PowerShell session:

$MyCreds = Get-Credential
Start-Process -FilePath repadmin.exe -ArgumentList "/syncall" -Credential $MyCreds

That way, you could leverage the security of PowerShell's credential management and just run the process under an account that has access to perform the replication.

Upvotes: 0

Related Questions