How to complete a "Defend [Settlement]" quest if no one's there?

Listed in my quests, under 'miscellaneous', is Defend Graygarden. I fast traveled there to find only one bad guy present and they were quickly dispatched, but the quest didn't update or become complete.

I'm playing on PC so all console options are available to me. Attempted, but with no success, I tried disable/enable on the one corpse, resurrect no less than ten times, and killall - nojoy. The first time this happened, I just had to scout a (very) wide perimeter to find the baddies; this time, no such luck.


Kill an Offender Within the Build Zone.

In my case at Graygarden, the baddie spawned outside the buildable area and was killed on the spot.

Using moveto [BadguyID#], brought the corpse to my location (standing inside the town proper). Then I used resurrect and in short order the quest was complete.

I did however have a corpse to work with in the first place. If there really never was anyone there, I'd assume you could spawn the right BadguyID to achieve the same effect. Mine was a 'Synth' settler; it may need to be a raider or a mutant, e.g.

Also note, that my resurrecting and "killing" 10+ guys (outside the construction area) may or may not have had any effect on the outcome.

Edit: It happened again; this time at Red Rocket. "Killing" ten guys seems to be key: I looted them every time I did it, ending up with 10 Synth parts.

Tenth time's the charm.