Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running the script, term 'reg' is not recognized - no access to system32\reg.exe #16

Open
iospoisson opened this issue Dec 20, 2023 · 9 comments
Labels
documentation Improvements or additions to documentation

Comments

@iospoisson
Copy link

`The term 'reg' is not recognized as the name of a cmdlet, function, script file,
or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:1 char:1

  • . $env:HOMEPATH\EnableLoudness.ps1 -releaseTime 2
  •   + CategoryInfo          : ObjectNotFound: (reg:String) [EnableLoudness.ps1], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException,EnableLoudness.ps1`
    
@Falcosc
Copy link
Owner

Falcosc commented Dec 20, 2023

You need a standard Windows installation and a non modified environment
Here is the normal output of a normal powershell:

PS C:\Users\falco> get-command reg

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Application     reg.exe                                            10.0.22... C:\WINDOWS\system32\reg.exe

As you see, Powershell has access to the windows path and will find the reg.exe in system32.
It is not good enough to use the PowerShell functions for registry adjustments, only system32\reg.exe is able to bypass write restrictions without adding custom permissions to the sound registry keys.

So if you don't have access to system32\reg.exe this tool will not work.
It is kind of a security issue that reg.exe is able to bypass the "no admin access, system only" restriction. So very likely that a hardened system with reduced permissions will not have access to system32\reg.exe

@Falcosc Falcosc changed the title Error running the script can you please help thank you Error running the script, term 'reg' is not recognized - no access to system32\reg.exe Dec 20, 2023
@laminetrad
Copy link

How to solve this problem?

@Falcosc
Copy link
Owner

Falcosc commented Dec 28, 2023

You need to tell why your user does not have access to the standard registry edit tool.
You need access to C:\WINDOWS\system32\reg.exe
And your PATH variable needs to be correct.
If you have done these checks and gain access to these system tools, then you can use get-command reg in powershell to confirm if you have a normal windows installation without restrictions.
If get-command reg does not work, then you need to get a user with more permissions or you need to fix your environment setup.

@laminetrad
Copy link

cmd
I'm still getting this error, not sure what you said, I'm new to this, the PATH variable must be corrected how? And what do you mean by access to C:\WINDOWS\system32\reg.exe

@Falcosc
Copy link
Owner

Falcosc commented Dec 28, 2023

The Script calls "reg"
With the help of the global Windows environment variable named "PATH", it looks for a reg.exe in multiple locations. On Windows, reg.exe is a system tool stored at C:\WINDOWS\system32\reg.exe

So you either don't have permissions to use your operating system tools, or you or your administrator did change the PATH variable or restricted your access to reg.exe.

Please ask somebody for personal tech support. I don't want to share any manuals which does touch your system tools, since if followed incorrectly things can break without you knowing how to undo.
But I can give you a check to test if your system is a normal or not.
You can type the following command into PowerShell to test if your access to reg.exe got fixed:

get-command reg

if everything is fixed on your computer, it will respond with the following output:

PS C:\Users\falco> get-command reg

CommandType     Name                               Version    Source
-----------     ----                               -------    ------
Application     reg.exe                            10.0.22... C:\WINDOWS\system32\reg.exe

@laminetrad
Copy link

No problem, I've found the solution, thanks anyway.

@Falcosc
Copy link
Owner

Falcosc commented Dec 28, 2023

@laminetrad Was it something about how you run it? If yes, please share it, as long as it doesn't involve changing PATH or system32 :)

@laminetrad
Copy link

It was about adding the right path to the Environment Variables

@Falcosc Falcosc added the documentation Improvements or additions to documentation label Jan 6, 2024
@spadab
Copy link

spadab commented Apr 20, 2024

No problem, I've found the solution, thanks anyway.

HOW FIX?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants