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 ObamaDemocratic governors fizzle in presidential race Obamas reportedly buying Martha's Vineyard mansion Trump has 62 percent disapproval rating in new AP poll 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 McCainCindy McCain says no one in Republican Party carries 'voice of reason' after husband's death Anti-gun violence organization endorses Kelly's Senate bid McCain's family, McCain Institute to promote #ActsOfCivility in marking first anniversary of senator's death 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 WickerWill Congress act to stop robocalls? Hillicon Valley: Trump reportedly weighing executive action on alleged tech bias | WH to convene summit on online extremism | Federal agencies banned from buying Huawei equipment | Lawmakers jump start privacy talks The Hill's Morning Report - How will Trump be received in Dayton and El Paso? 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.