<p>I get an Access is Denied error message when I use the strong name tool to create a new key to sign a .NET assembly.  This works just fine on a Windows XP machine but it does not work on my Vista machine.</p>

<pre><code>PS C:\users\brian\Dev\Projects\BELib\BELib&gt; sn -k keypair.snk

Microsoft (R) .NET Framework Strong Name Utility  Version 3.5.21022.8
Copyright (c) Microsoft Corporation.  All rights reserved.

Failed to generate a strong name key pair -- Access is denied.
</code></pre>

<p>What causes this problem and how can I fix it?</p>

<hr>

<blockquote>
  <p>Are you running your PowerShell or
  Command Prompt as an Administrator? I
  found this to be the first place to
  look until you get used to User Access
  Control or by turning User Access
  Control off.</p>
</blockquote>

<p>Yes I have tried running PS and the regular command prompt as administrator.  The same error message comes up.</p>

[{'answer_id': 11891, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 2, 'selected': False, 'text': '<p>Are you running your PowerShell or Command Prompt as an Administrator?  I found this to be the first place to look until you get used to User Access Control or by turning User Access Control off.</p>\n'}, {'answer_id': 11898, 'author': 'Dale Ragan', 'author_id': 1117, 'author_profile': 'https://Stackoverflow.com/users/1117', 'pm_score': 6, 'selected': True, 'text': '<blockquote>\n  <p>Yes I have tried running PS and the\n  regular command prompt as\n  administrator. The same error message\n  comes up.</p>\n</blockquote>\n\n<p>Another possible solution could be that you need to give your user account access to the key container located at C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Crypto\\RSA\\MachineKeys</p>\n'}, {'answer_id': 11936, 'author': 'Kev', 'author_id': 419, 'author_profile': 'https://Stackoverflow.com/users/419', 'pm_score': 2, 'selected': False, 'text': '<p>Why not fire up sysinternals Process Monitor too see what you can see, it\'s the first thing I always do when I get any kind of access denied message?</p>\n\n<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx</a></p>\n'}, {'answer_id': 580612, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 2, 'selected': False, 'text': "<p>Some people rebuild their machines to resolve this problem, but it can be solved by giving user access to the key container <strong>C:\\Documents and Settings\\All Users\\Application Data\\Microsoft\\Crypto\\RSA\\MachineKeys</strong>\nEach container created using sn.exe -i is located in the MachineKeys directory (unless you specify elsewhere). The default key container that is used by sn.exe is also in that location.</p>\n\n<p>In case you reset your key container to a new one, and forget where it is.. you can reset the key container for the strong name utility using sn.exe -c. So, if the account access fix doesn't work, you may be using an alternate key store so a reset may be in order.</p>\n"}, {'answer_id': 1816786, 'author': 'ChrisWue', 'author_id': 220986, 'author_profile': 'https://Stackoverflow.com/users/220986', 'pm_score': 2, 'selected': False, 'text': '<p>Just to update this a bit: I ran into the same problem on Vista. My local user on the PC had no problem but then we switched to a domain and my domain user (albeit having local admin rights) got "Access Denied".\nI granted my domain user access rights to <strong>C:\\Users\\All Users\\Microsoft\\Crypto\\RSA\\MachineKeys</strong> and that fixed it.</p>\n'}]
['https://Stackoverflow.com/questions/11887', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1254/']