Three Romanians broke into a car parts firm in the Black Country in a bid to steal metal, a court heard.
Two of them armed themselves with metal "strips" to defend themselves against the dog which lives there, magistrates were told.
But the three were stopped in their tracks by the owner of FW Compound in Darlaston, who called police at around 11.15pm on October 31.
The three were arrested in a police crackdown on rising metal thefts in the borough, which have seen rail cables and brass door handles stolen.
Adrian Ciobanu, aged 26, of Owen Road, Penn Fields in Wolverhampton, Auras Stoica, 27, of the same address and Claudiu Bolboaca, 20, of Lion Road, Edmonton in London, admitted attempted theft when they appeared at Walsall Magistrates Court yesterday.
They were each given a 12-month conditional discharge and ordered to pay £85 costs.
The men broke into the car parts stock yard looking for metal but business owner Francis Thomas happened to be there at the time and heard the dog barking loudly.
Miss Maxine Jarrousse, prosecuting, said: "At that point Mr Thomas said he heard metal jangling from within the compound, and noticed two men, to which he shouted.
"He asked them what they were doing, to which they then began to run off."
Police arrived within minutes, found the men outside and arrested them.
Mr Martin Fawlk, defending, said the attempt was not planned, and the men "had no idea what they were going to do if they had found any parts." He added: "Each of the defendants expresses remorse for their actions."
Sentencing them chairman of the magistrates Mr Mick Kearns said: "We are concerned in the Walsall area as there seems to be a number of these thefts and attempted thefts for metal."
Police in the town are visiting every scrapyard in the borough in a crackdown.
Crimes have included £25,000 of copper stolen from a Brownhills firm, £1,000 of brass from a Walsall saddlery and more than 30 manhole covers.