Skip to content

sc : Access to the path 'C:\windows\system32\config' is denied. #1700

Closed
@isdanni

Description

@isdanni

OperatingSystem:

PS C:\windows\system32> [System.Environment]::OSVersion.Version

Major  Minor  Build  Revision
-----  -----  -----  --------
10     0      18363  0

What is failing

  • Following this guide in vscode on how to configure ssh-agent in PowerShell(run as admin), but running cmds(I have openSSH installed already) gave me the following error:
PS C:\windows\system32> sc config ssh-agent start==auto
Set-Content : A positional parameter cannot be found that accepts argument 'start==auto'.
At line:1 char:1
+ sc config ssh-agent start==auto
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Set-Content], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.SetContentCommand

PS C:\windows\system32> sc config ssh-agent
sc : Access to the path 'C:\windows\system32\config' is denied.
At line:1 char:1
+ sc config ssh-agent
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Set-Content], UnauthorizedAccessException
    + FullyQualifiedErrorId : System.UnauthorizedAccessException,Microsoft.PowerShell.Commands.SetContentCommand
  • Run as admin.

Expected: Should show config success as it did on my other PC.

So far I tried

  1. restart Powershell, run as admin & repeat above steps;
  2. Checked this issue
  3. Restart ssh-agent.
  4. Check ssh status:
PS> ssh-agent.exe
unable to start ssh-agent service, error :1058


PS C:\windows\system32> ssh-agent.exe
PS C:\windows\system32> Get-Service ssh-agent

Status   Name               DisplayName
------   ----               -----------
Running  ssh-agent          OpenSSH Authentication Agent

PS C:\windows\system32> Start-Service ssh-agent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions