Robert Dean and Alan Jones were stopped on Leeming Street, at 6.15pm, on February 12, with another man.
Officers asked what they were doing with two computers, coffee, a toy gun, perfume, Lego, and assorted cables, and they initially claimed they found the items in a skip.
The laptop was traced to the Clerkson Business Centre, on St Peter’s Way, where an office with an unlocked door had been untidily searched.
The court heard that they had been approached by a third man at a soup kitchen in the town centre, who told them about somewhere they could sleep.
Sarah Neale, for Dean, 38, said he had struggled with alcohol problems since the age of 13, and had been living on the streets on and off.
He was currently sleeping in a tent in a friend’s back garden. She said he had been told if he keeps on drinking “ultimately, it will kill him.”
Simon Greaves, for Jones, 49, said he had formerly been a mechanic, but had fallen on hard times and had been homeless for three years.
“He is solely dependent on charity” said Mr Greaves. “He is unable to access benefits.”
A third man had been sentenced to three months on February 23, consecutive to six months for possession of an offensive weapon and theft.
Both men admitted theft by burglary at Mansfield Magistrates Court on Thursday, March 9.
They were each handed a 12 month community order, and told to pay an £85 victim surcharge each.