Try the following:
gci | Where { $_.Name -Match '\d{8}'} | ForEach {
if ($_.Name -Match '^(\d{8})_(.+)$') {
Rename-Item $_ ( $_.Name -Replace '^(\d{8})_(.+)$','$2_$1' ) }
elseif ($_.Name -Match '^(.+_)(\d{8})_(.+)$') {
Rename-Item $_ ( $_.Name -Replace '^(.+_)(\d{8})_(.+)$', '$1$3_$2' ) }
}
The code checks where the 8 digits are found in the filename (beginning or other) and rename the files accordingly. No need to check if the 8 digits are at the end.