I agree that an electric fence can work very well and is immediately effective. I expanded ours last year to keep wandering guinea fowl in. Every guinea is staying in our yard this spring and 95% of the time I open up the fence and let the entire flock free range. We can leave the poultry fence shut if we'll be gone.
We have a Great Pyrenees that we got as a puppy. He spent his first 8 years solely with our sheep. Now he guards all the livestock. He was familiar with the chickens in the fence but I forgot about him when I opened up the netting for them to free range. He never bothered any poultry. He actively guards all the livestock between our two farms, he guards my husband's free-ranging bunnies and he even guards our senior dog (16), Max...lol. (Max is in the yellow doghouse, there are 7 doghouses, a barn and 2 sheds our Pyrenees could go into. But he guards Max.)
He is our first Pyrenees but won't be our last. I chose Great Pyrenees because the breed is not supposed to be human aggressive. Our son was quite young at the time and we wanted a dog that would be safe around other children. He avoids all new people.
Guarding the yard................Mr. Shuster choosing to be with Kujo
View attachment 1721797 View attachment 1721814
View attachment 1721834 View attachment 1721838 View attachment 1721823
Kujo guarding the sheep........Kujo guarding the coop

.......Kujo guarding Max
On the other hand, some dogs are not protectors. In the picture below, that coyote is right in our yard. Max was young at the time. He is half border collie/half rough collie. He was a stray, we found his owners and they ended up giving him to us. He was good at helping with the cattle. Now he's good at hogging all the dishes and food from Kujo...lol.
View attachment 1721831