- #Terminal server windows 2012 r2 security error certificate how to#
- #Terminal server windows 2012 r2 security error certificate trial#
If you want to see where private keys are stored, check out Key Storage and Retrieval. The TheMadTechnician answered this question like a mf'n champ. We use that to deduce the key file's location. We then grab the UniqueName (Key property has a UniqueName property). We're using the GetRSAPrivateKey() method of the 509Certificates.RSACertificateExtensions static class to return us the private key.
Set-Acl -Path $privatekey_path -AclObject $privatekey_file_permissions $privatekey_file_permissions.AddAccessRule($access_rule) $access_rule = New-Object ($grantee, 'Read', 'None', 'None', 'Allow') # Grant the user 'read' access to the key On the domain CA Launch the Certification Authority Management Console > Certificates Templates > Right click > Manage. Solution Create an RDP Certificate Template. If you need that level of security, that should already be done by 802.1x. $privatekey_file_permissions = Get-Acl -Path $privatekey_path IT DOES NOT stop clients connecting to an RDP server if they do not have a trusted certificate. # Look up the certificate's reference object in the store $store = New-Object 509Certificates.X509Store("My","LocalMachine") Then I open the local machine certificate store as Read/Write, and find the certificate that I'm looking for: # Define the thumbprint of the certificate we are interested in $AccessRule = New-Object ($User, 'FullControl', 'Allow') # Define AccessRule to be added to the private key, could use 'GenericRead' if all you need is read access I start by defining the user object, and the access that I want to grant them: # Create NTAccount object to represent the account
#Terminal server windows 2012 r2 security error certificate trial#
So much web searching, a few articles, and a fair bit of trial and error led me to this. I too found a number of places telling me to modify the ACLs of the key data on the hard drive, but that was not satisfying since when I checked the permissions to the private key using PowerShell the user I added wasn't listed. I recently went through automating access to certificate private key myself. I need to do this through Powershell some how. Unfortunately, I need to automate the permission assignment so using the Certificates MMC-snapin isn't an option. I can manage permissions on the private key. When using the Certificates MMC-snapin, I can see the certificate. However, in this case, the private key is in the registry at the following: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SystemCertificates\MY\Keys
In the cases where the solution I just eluded to works, the private key is on the file system. While the certificate has a private key, the private key data member is null:
#Terminal server windows 2012 r2 security error certificate how to#
Now, there are about 1,000 articles instructing people how to grant permission by retrieving the UniqueKe圜ontainerName with code that starts like the following: $圜ontainerInfo.UniqueKe圜ontainerName Problem: I can't figure out how to grant a service account rights to the certificate's private key. A certificate is generated for the machine and placed in it's "Cert:\LocalMachine\My" as requested. I'm requesting a certificate for the host from the domain's CA. CertStoreLocation 'Cert:\LocalMachine\My' On a Windows Server 2012 R2 machine attached to a domain, I am running the following statements: $target_machine_fqdn = ::GetHostByName($env:computerName)