The 'problem' here is a mechanic called Radar Dampening. Most, but not all, Guard Posts have a Radar Dampening range, which means all hostile ships(except those with Radar Dampening Immunity, which are fairly rare), must close to at least the listed range in order to fire upon it. This range is almost always shorter than the range of the unit's weapons, so there's usually no way to shoot Guard Posts down with impunity. Even though the range listed is 'infinite', Radar Dampening on the target overrides that.
Sniper Turret
structures do have Radar Dampening Immunity, and one can use a
Beachhead strategy to use them offensively, but that's the only generally-available RD-Immune unit.
Drone spawner ships like Neinzul Enclave Starships or Spire Blade Spawners also technically get around this by essentially generating and releasing short-lived 'disposable ships' whenever hostile units are around. The released drones themselves are still affected by Radar Dampening, but the 'parent' ship does not have to close to within the unit's Radar Dampening range.