Zend certified PHP/Magento developer

Powershell 5 script stopped working once upgraded to powershell 7

I am trying to call Systemparmatersinfo to update my mouse scheme in powershell 7.
I am having a hard time to fix the issue with the new powershell 7.
this is the script I am trying to do to change my mouse scheme:

$RegConnect = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]"CurrentUser","$env:COMPUTERNAME")
$RegCursors = $RegConnect.OpenSubKey("Control PanelCursors",$true)
$RegCursors.SetValue("Wait","%SYSTEMROOT%CursorsW11_dark_v2.2busy.ani")
$RegCursors.Close()
$RegConnect.Close()
Add-Type @"
    using System.Runtime.InteropServices;
    public class WinAPI {
        [DllImport("user32.dll", EntryPoint = "SystemParametersInfo", SetLastError = true)]
        public static extern bool SystemParametersInfo(uint uiAction, uint uiParam, string pvParam, uint fWinIni);
    }
"@
[WinAPI]::SystemParametersInfo(0x0057, 0, $CursorsPath, 0)

Get-Variable $CursorsPath

But It does not work/change my mouse scheme as I wanted to. How can I fix this using the new powershell 7?