Author Topic: An attempt was made to reference a token that does not exist  (Read 12912 times)

0 Members and 1 Guest are viewing this topic.

Offline whiggs

  • Jr. Member
  • **
  • Join Date: Aug 2015
  • Posts: 99
  • Karma: 1
    • View Profile
An attempt was made to reference a token that does not exist
« on: October 09, 2017, 04:36:00 AM »
There is a bug with Windows AIO repair.  After I run the repair "register system files", if I have the Remote Server Administration Toolkit (RSAT) is installed on my machine and I try to open "Active Directory Users and Computers", I get the above error and the one attached to this post.  I already found the fix: I simply have to re-register all of the dlls in the "System32" folder with the below command, and it starts working again immediately:
for /f %s in ('dir /b *.dll') do regsvr32 /s %s, C:\Windows\system32
EDIT:   Usually this resolves the issue.  However, and I don't know if Windows AIO repair causes this issue or not, but the above command did not fix it for me this time.  It took me a lot of research to find this, but the reason that the error is occurring is because certain registry keys were improperly modified:
HKEY_CLASSES_ROOT\mscfile\shell

When I expanded Author\command, open\command, and RunAs\Command, the default registry key for each entry was pointing to the 32-bit version of the mmc executable in '%SystemRoot%\SysWow64\mmc.exe "%1" %*'.  These registry keys need to be changed to point to the mmc executable in the "system32" folder instead.  Then it worked like a charm.

« Last Edit: October 09, 2017, 05:44:09 AM by whiggs »

Offline Willy2

  • Hero Member
  • *****
  • Join Date: Oct 2011
  • Posts: 1057
  • Karma: 17
    • View Profile
Re: An attempt was made to reference a token that does not exist
« Reply #1 on: October 09, 2017, 07:26:51 AM »
- What OS are you running ?
- Does this happen in each version of Windows Repair or only the one (e.g. the last) version ?
- Running the Regsvr32 command for all *.dll files is not to be recommended. It's possible that you "break" more things in Windows than you "fix".

Offline whiggs

  • Jr. Member
  • **
  • Join Date: Aug 2015
  • Posts: 99
  • Karma: 1
    • View Profile
Re: An attempt was made to reference a token that does not exist
« Reply #2 on: October 19, 2017, 08:23:03 PM »
It was in windows 10 anniversery update Enterprise edition (so not the most current release, the previous release from the current release).  Haven't tried it on any other system.  Also, didn't run the command until after I found the issue.  Also, in regards to your statement that registering all of the dlls in the system32 folder is a bad idea, try doing a google search of the error this post references and see how many microsoft forum sites recommend doing just that
https://social.technet.microsoft.com/Forums/ie/en-US/dd05eca6-0f10-4b43-a860-6846cea310e7/error-an-attempt-was-made-to-reference-a-token-that-does-not-exist?forum=winserverManagement
https://social.technet.microsoft.com/wiki/contents/articles/6338.microsoft-management-console-an-attempt-was-made-to-reference-a-token-that-does-not-exist.aspx
I could go on and on, but I think the point has been made