The security of Windsor Castle has been an important issue since Windsor Castle's foundation in the 11th century.
Security of Windsor Castle Wikipedia
Windsor Castle originally became a royal residence because of the protection it could afford to Henry I. Successive medieval and Tudor monarchs made use of the castle during revolts, plagues and other crises, including Henry VIII and Elizabeth I.
By the 1740s, security at Windsor Castle had diminished markedly and the site had become an early tourist attraction; wealthy visitors who could afford to pay the castle keeper could enter and stroll around the castle. As the condition of the State Apartments continued to deteriorate, even the general public were able to regularly visit the property, with children and others playing in the castle yards. George III gradually reversed this trend when he came to the throne in 1760. This trend continued during the reign of Queen Victoria, when the Windsor Castle and Town Approaches Act was passed by Parliament, permitting the closing and re-routing of the old roads which previously ran through the park from Windsor to Datchet and Old Windsor. These changes allowed the Royal Family to undertake the enclosure of a large area of parkland to form the private "Home Park" with no public roads passing through it, creating a much more private and secure royal palace than had previously been the case.
Although this has been less well publicised than Buckingham Palace, security at Windsor Castle has occasionally been breached, most seriously in 2003 when an intruder (the self-styled "comedy terrorist", Aaron Barschak) "gate-crashed" the 21st birthday party of Prince William, but most recently in March 2012, when an intoxicated man scaled a fence and got within yards of the Queen's private apartments before being arrested by armed protection officers. Police from the Thames Valley Police and from the Royalty and Diplomatic Protection Department of the London Metropolitan Police provide the main element of physical security. The Windsor Castle Guard of the Foot Guards of the Household Division, provided by a public duties battalion in London, or by the battalion at Victoria Barracks, Windsor, contributes to this.
The Foot Guards battalion at Victoria Barracks, a quarter of a mile from the Castle, is supported by the armoured reconnaissance squadron of the Household Cavalry based at Combermere Barracks, Windsor, one mile (1.6 km) from the Castle. In times of emergency at the castle, several hundred soldiers, as well as the FV107 Scimitar Light Tanks of the Household Cavalry, would be able to respond quickly to protect the castle and its occupants.
All visitors are asked to go through airport style security, with luggage being X-rayed and persons walking through a metal detector.