Implementing a hardware banning system will take a bit more sophistication than that code you posted. You can very easily circumvent the system() call by placing a user-created wmic.exe in the same directory as the calling program that outputs a modified test.txt.
Do not ban by hardware. You will be relying on information provided by the user's own system. This can easily be spoofed by the user and renders the ban ineffective and opens up potential to abuse.
An example of abuse would be someone spoofing the hardware configuration of many systems (serial numbers are well... serial in nature... A7-372B5 comes after A7-372B4, etc) and getting the hardware banned potentially locking out legitimate users/customers with no real means to verify the legitimacy.
If you really still want to ban by hardware, use the tried and true methods to do so, either write a kernel mode driver to give you unrestricted access to the hardware to get less unreliable information, or use the less reliable NIC MAC address or HDD serial.
I must stress that this is a very bad approach to a problem that was solved a long time ago. Use a network-based authentication system.