The Senate voted unanimously on Wednesday to confirm Gen. David Petraeus as the next commander of U.S. forces in Afghanistan.

All senators in both parties voted overwhelmingly to install Petraeus in the new role, filling the role of resigned Gen. Stanley McChrystal.

Petraeus was confirmed 99-0. The missing vote was the late Sen. Robert Byrd (D-W.Va.), who died Monday.

President Barack ObamaBarack Hussein ObamaBooker dismisses early surveys: 'If you're polling ahead right now, you should worry' Let's not play Charlie Brown to Iran's Lucy Mattis dodges toughest question MORE named Petraeus, who led counterinsurgency efforts in Iraq and was serving as director of U.S. Central Command (CENTCOM), to his new post last week after McChrystal resigned over an uproar caused by a Rolling Stone magazine article.

The move was quickly praised by leaders in both parties. Sen. John McCainJohn Sidney McCain The 13 Republicans needed to pass gun-control legislation Biden's debate performance renews questions of health At debate, Warren and Buttigieg tap idealism of Obama, FDR MORE (R-Ariz.), the ranking member of the Senate Armed Services Committee, predicted Petraeus would have one of the shortest confirmations in Senate history. That proved true, as the general testified and was voted out of the committee on Tuesday and then confirmed by the full Senate Wednesday.  

Obama praised the Senate for its quick action.

"The Senate's quick action and General Petraeus's unrivaled experience will ensure we do not miss a beat in our strategy to break the Taliban's momentum and build Afghan capacity," he said in a statement.

Petraeus's nomination was all but assured, and one senator, Roger WickerRoger Frederick Wicker The 13 Republicans needed to pass gun-control legislation GOP lawmaker: 'Dangerous' abuse of Interpol by Russia, China, Venezuela Suburban anxiety drives GOP on guns MORE (R-Miss.), suggested Tuesday on MSNBC the general could have passed that afternoon with a unanimous consent agreement.

The roll call vote has the effect of putting each senator on record in support of Petraeus's new role in Afghanistan.

There was some speculation that Sen. Russ Feingold (D-Wis.), a skeptic of U.S. strategy in Afghanistan, might vote against confirmation for Petraeus, but he ultimately joined with fellow Democrats in support of the appointment.

-- Sam Youngman contributed to this post.

-- This post was updated at 2:11 p.m.