You need to do the quest from McNamara to get the holodisks from the patrols.
You also need to ask Ramos to give you access to the records.
And you need to help the Scribe catch the virus (need high science for this one, no other way around it that I know of)
Once you trap the virus, you can check any of the consoles for info about the BoS, including the code.
You tell Hardin that McNamara jumped the code (chain of command) by giving the patrols specific orders without sending the orders through him.
Hardin replaces McNamara.
It must be bugged somehow for me then.I did the same things you did, although not in the same order.I did the computer virus first, then went out and obtained the patrol disks.I then had a quest to speak with some scouts, completed that (saved) then handed over evidence to Hardin.That resulted in a never completed leadership challenge.
I read on wiki that you should do the filtration quest first to stop a dead-end, so I reloaded and went about it that way, handed in the filtration parts, then spoke with Hardin.Still the same dead end.
It was so much easier on my legion playthrough, when I just slaughtered everyone, then blew up the bunker.