mirror of
https://github.com/MichaelGrafnetter/DSInternals
synced 2025-04-26 21:08:27 +00:00
- Added the UserPrincipalName parameter to Get-ADReplAccount cmdlet - Improved DRS_MSG_GETCHGREQ_V8 delete - Fixed Set-ADDBBootKey cmdlet output type - Fixed some formatting inconsistencies
47 lines
1.5 KiB
C#
47 lines
1.5 KiB
C#
using System.Management.Automation;
|
|
using System.Security.Principal;
|
|
|
|
namespace DSInternals.PowerShell.Commands
|
|
{
|
|
[Cmdlet(VerbsCommon.Add, "ADReplNgcKey")]
|
|
[OutputType("None")]
|
|
public class AddADReplNgcKeyCommand : ADReplPrincipalCommandBase
|
|
{
|
|
// TODO: Change to X509Certificate2
|
|
[Parameter(Mandatory = true)]
|
|
[AcceptHexString]
|
|
public byte[] PublicKey
|
|
{
|
|
get;
|
|
set;
|
|
}
|
|
|
|
protected override void ProcessRecord()
|
|
{
|
|
switch (this.ParameterSetName)
|
|
{
|
|
case ParameterSetByGuid:
|
|
this.ReplicationClient.WriteNgcKey(this.ObjectGuid, this.PublicKey);
|
|
break;
|
|
|
|
case ParameterSetByDN:
|
|
this.ReplicationClient.WriteNgcKey(this.DistinguishedName, this.PublicKey);
|
|
break;
|
|
|
|
case ParameterSetByName:
|
|
this.ValidateDomainName();
|
|
this.ReplicationClient.WriteNgcKey(new NTAccount(this.Domain, this.SamAccountName), this.PublicKey);
|
|
break;
|
|
|
|
case ParameterSetBySid:
|
|
this.ReplicationClient.WriteNgcKey(this.ObjectSid, this.PublicKey);
|
|
break;
|
|
|
|
case ParameterSetByUPN:
|
|
this.ReplicationClient.WriteNgcKey(new NTAccount(this.UserPrincipalName), this.PublicKey);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|