Denis Hennessy admitted the charge at Westminster Magistrates' Court Friday.
He scaled the wall of the Palace Thursday before "admiring" the gardens for 10 minutes, the court heard.
Hennessy, of Barnhill Road, Wembley, north-west London, cut his right hand as he climbed over the top of the wall, which is between 8ft to 10ft high, and set the alarm off.
He then walked around the gardens for around 10 minutes towards the Palace, where the Queen was in residence with the Duke of Edinburgh and the Duke of York, before being arrested by armed police.
As he was detained, he asked "is Ma'am in?" repeatedly, prosecutor Tom Nicholson told Westminster Magistrates' Court.
In interview he told police he had "walked through the gardens admiring the view".
Hennessy, 41, pleaded guilty to one count of trespass on a protected site and one count of criminal damage.
The court heard he was on license after being convicted of the murder of a homeless man in 1992.
Chief magistrate, senior district judge Howard Riddle, sentenced him to four months for trespassing and two months, to run concurrently, for damaging the wires of the alarm system.