PSS in VisualStudioCode using outside VSC


I have a question. I am using this PSS in VSC and it works fine. But if i run the PSS outside VSC it doesn’t work. Maybe someone knows what kind of issue i am confronted with.

Thanks a lot


function Test-RegistryProperty {
    param (


    try {
        Get-ItemProperty -Path $Path | Select-Object -ExpandProperty $Property -ErrorAction Stop | Out-Null
        return $true
    catch {
        return $false

$PropertyPath = "HKLM:\SOFTWARE\WOW6432Node\Microsoft\Jet\4.0\Engines\Text"

$Property = Test-RegistryProperty -Path $PropertyPath -Property Format

$IsValue = Get-ItemProperty -Path $PropertyPath | Select-Object -ExpandProperty Format

$MustValue = "Delimited(;)"

if ($Property) {
    if ($IsValue -ne $MustValue) {
        Set-ItemProperty -Path $PropertyPath -Name Format -Value $MustValue -Force
    else {
        New-ItemProperty -Type String -Path $PropertyPath -Name Format -Value $MustValue


what is “PSS”? And what do you mean with …

When I read the value from the registry I get “CSVDelimited” … without “(;)

PSS = PowerShellScript (sorry the files are name.ps1, my fault, i will avoid the shortcuts).

That’s the problem I don’t know why it doesn’t work. If i run the script in VSC Editor the Registry will be changed in Delimited(;). But if i run the script via PS Editor nothing happens and i get no error message or something like that and nothing is chaning in the registry.

That should have been as well in your initial description. :wink:

It seems like it is an issue with your particular pc. It works for me as expected. Did you try it in a clean console?

Thanks for the help, now I get the error “Requested registry is not allowed” in line 29. Ok, console as admin get’s no error.

Set-ItemProperty -Path $PropertyPath -Name Format -Value $MustValue -Force

I assumed that you know that you need to run this with admin rights when you want to write to this registry path.

Does that mean it works as expected?

I set the script into a gpo for the computer, so no admin right is necessary for the nt-authority. but you are right, and i forget that i changed my settings for VSC to always run as admin. i placed it in the starting sequence. I guess, because my laptop in homeoffice will not start in the domain network, the script will not run. but it’s just a guess. :slight_smile: thanks for your help.

You don’t need a script to deploy registry setting by GPO!! :wink:

Yeah it’s a bit overhead :slight_smile: but i wan’t to check in beforehand if the delimiter is set or not and if the registry even existis. i guess i can deploy the registry by gpo.