It is relatively effective. Most people don't pirate things because it's illegal. Especially corporations are less likely to pirate software because of the serious legal consequences.
Note that I said bits, not only software. Most everyone has their music collection. Also, in regards to software, show me an average person who hasn’t had a pirated version of, say, Photoshop or MS Office. Even in business office settings it is, I am given to understand, very common.
Also, does a mere legal barrier suffice to make something an excludable good? Could you turn, for example, the observing of the Statue of Liberty into an excludable good merely by passing a law mandating that only those allowed may observe it?