You can hack it, but you can only either activate or deactivate it. I don't think it would shoot for you, even then, they destroy turret pretty quick. The BoS spawning endlessly, so it's pretty useless to take them head on in the first place. It's more likely to go on the side building, destroy the machine, allowing synth soldiers to relay there.

That'll teach them to trash talk Owen Lyons. Hell, I wonder if there is a mod that lets you bring your settlers into the fray. I gave my guards at the castle full medium polymer combat armor and legendaries that aren't good enough for me to use or on the wrong weapon, but not crappy enough to sell. My own pesonal commandos. I should call them the S3 The Sole Survivor Squad.
