At an ex parte hearing, that's exactly how it works. However, that usually is only a "temporary order" - erring on the side of safety - pending a hearing for a "final order". At that second hearing, you would have the chance, as a respondent, to contest the allegations, and legally defend...