When I used macOS Mojave I always used this AppleScript automatized with Keyboard Maestro, to auto close the boring system message Disk Not Ejected Properly. It always worked fine with Mojave. Now with Big Sur it doesn't do anything. What's the problem? Maybe it may be necessary to change something in the script? I solved it in another way for now, but that solution was more clean and elegant.
tell application "System Events"
tell process "NotificationCenter"
set numwins to (count windows)
repeat with i from numwins to 1 by -1
tell window i
set temp to value of static text 1
end tell
if temp contains "Disk Not Ejected Properly" then
click button "Close" of window i
end if
end repeat
end tell
end tell