Create folder in Users OneDrive Location while Launching the program

Hi, I need help. I am working on a script where I need to apply the below logic.
After Migrating from Home Drive to OneDrive application setting needs to Roam users setting where ever they log in. else users manually need to set the program preference each time they log in to a different machine
Check if .exe is installed
Check one drive installed and logged in
if Onedrive installed and logged in check current user reg key exists
if not create reg key's and point to one drive location
if the reg key exists then create a new folder in logged-on users OneDrive\Documents
then run the .exe file
if (Test-Path "C:\Program Files\Sigmaplot\SPW14.exe")
# Check to see if OneDrive is Installed
$Testpath = test-path "C:\Users\$env:username\AppData\Local\Microsoft\OneDrive\OneDrive.exe"
If ($Testpath -eq "True") {
$registryPath = "HKCU:\Software\Sigmaplot14\General"
$Name = "User Folder"
$value = "C:\users\$env:USERNAME\OneDrive\Documents\SPW14"
IF(!(Test-Path $registryPath))
New-Item -Path $registryPath -Force | Out-Null
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType "String" -Force | Out-Null
New-Item -ItemType Directory -Force -Path "C:\users\$env:USERNAME\OneDrive\Documents\SPW14" |Out-Null
Remove-Item -Path $registryPath |Out-Null
start-process -FilePath "C:\Program Files\Sigmaplot\SPW14.exe"

What is the outcome of the script you posted? Errors? Also, can you post your code using the instructions here