$PSScriptRoot and pause work fine on my Win11 laptop using PS 5.1.
"Running Powershell version {0}" -f $PSVersionTable.PSVersion
""
"Script root is {0}" -f $PSScriptRoot
""
"Here is the pause function."
get-command pause -ShowCommandInfo
""
"Execution policy is {0}" -f (get-executionpolicy)
""
"Remove whatif to update the execution policy. "
"Powershell needs to opened with 'Run as administrator' to do that."
set-executionpolicy RemoteSigned -whatif
""
"Demonstrate pause."
""
pause