0

I should start off by stressing that I have very, very little experience in PowerShell, so apologies if this is user error.

After copying the commands over from https://learn.microsoft.com/en-us/troubleshoot/developer/browsers/administration/k-12-assessments-reports-apps-background I keep hitting Unexpected Token errors on step 4. This is the code, along with the errors:

$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\PreLaunch\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" $Name = "Enabled" $value = "0" New-Item -Path $registryPath -Force | Out-Null New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null At line:1 char:138

  • ... ch\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge" $Name = "Enab ...
  •                                                         ~~~~~
    

Unexpected token '$Name' in expression or statement. At line:1 char:156

  • ... oftEdge_8wekyb3d8bbwe!MicrosoftEdge" $Name = "Enabled" $value = "0" N ...
  •                                                        ~~~~~~
    

Unexpected token '$value' in expression or statement. At line:1 char:169

  • ... d8bbwe!MicrosoftEdge" $Name = "Enabled" $value = "0" New-Item -Path $ ...
  •                                                      ~~~~~~~~
    

Unexpected token 'New-Item' in expression or statement. + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnexpectedToken

I've tried messing around with a few things and have gotten rid of some, but not all of the errors. Any help would be greatly appreacited!

1 Answer 1

2

Sample formatting on that documentation article is broken, it's hiding a couple of linebreaks:

$registryPath = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\PreLaunch\Microsoft.MicrosoftEdge_8wekyb3d8bbwe!MicrosoftEdge"
$Name = "Enabled"
$value = "0"
New-Item -Path $registryPath -Force | Out-Null
New-ItemProperty -Path $registryPath -Name $name -Value $value -PropertyType DWORD -Force | Out-Null
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.