Reputation: 1
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
~~~~~
Unexpected token '$Name' in expression or statement. At line:1 char:156
~~~~~~
Unexpected token '$value' in expression or statement. At line:1 char:169
~~~~~~~~
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!
Upvotes: 0
Views: 262
Reputation: 174825
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
Upvotes: 2