This should handle both IPv4 and IPv6 MAC address formats (with either ":" or "-" separators). I removed all the unnecessary grouping punctuation from the regexes. I also used two regexes for the IPv6 check because I think it's clearer than one long one). You can probably shorten them (and the IPv4 one, too):
Param(
[string] $Description,
[string] $BSSID,
[string] $LocationID
)
# Uncomment these!!!
#Import-Module MicrosoftTeams
#Connect-MicrosoftTeams -AccessTokens @("$graphToken", "$teamsToken")
$UpdatedBSSID = ""
# Test for IPv4 MAC address
if ($BSSID -match '([0-9A-F]{2})(:|-)([0-9A-F]{2})(:|-)([0-9A-F]{2})(:|-)([0-9A-F]{2})(:|-)([0-9A-F]{2})(:|-)([0-9A-F]{2})') {
$UpdatedBSSID = $BSSID -replace ':', '-'
} # Test for IPv6 MAC address
elseif ( $BSSID -match '[0-9A-F]{2}(:|-)[0-9A-F]{2}(:|-)[0-9A-F]{2}(:|-)[0-9A-F]{2}(:|-)[0-9A-F]{2}(:|-)[0-9A-F]{2}(:|-)[0-9A-F]{2}(:|-)[0-9A-F]{2}' -OR
$BSSID -match '[0-9A-F]{4}(:|-)[0-9A-F]{4}(:|-)[0-9A-F]{4}(:|-)[0-9A-F]{4}' ) {
$UpdatedBSSID = $BSSID -replace ':', '-'
}
else {
# Not sure what you want to do if MAC isn't in expected format
Throw "BSSIS is invalid : '$BSSID'"
}
try {
# Uncomment this!!!
# Set-CsOnlineLisWirelessAccessPoint -BSSID $UpdatedBSSID -LocationId $locationID -Description $Description -ErrorAction "Stop" -Verbose
}
catch {
# your error handling for failed action gores here
}
I don't know what you want to do in any of your error handling, though!
NOTE: I don't have any way to test with MS Teams so be sure to uncomment the cmdlets in the above code!