This was done once before in the 1960s by the US military. Nobody liked it then, and I suspect nothing has changed.
In July 1962, a 1.44 megaton United States nuclear test in space, 400 km above the mid-Pacific Ocean, called the Starfish Prime test, demonstrated to nuclear scientists that the magnitude and effects of a high altitude nuclear explosion were much larger than had been previously calculated. Starfish Prime also made those effects known to the public by causing electrical damage in Hawaii, more than 800 miles away from the detonation point, knocking out about 300 streetlights, setting off numerous burglar alarms and damaging a telephone company microwave link.
The EMP damage of the Starfish Prime test was quickly repaired because of the ruggedness (compared to today) of the electrical and electronic infrastructure of Hawaii in 1962. Realization of the potential impacts of EMP became more apparent to some scientists and engineers during the 1970s as more sensitive solid-state electronics began to come into widespread use.