CommandBars collection of the VBE (root) object of the VB Editor Object Model. get-activeObject is defined in the COM PowerShell module. $xls = get-activeObject excel.application
$cmdBars = $xls.VBE.CommandBars
foreach ($cmdBar in $cmdBars){
$cmdBar.name
foreach ($control in $cmdBar.controls) {
" - $($control.caption) ($($control.id))";
}
}