Windows 10: How do I use PowerShell commands to change Permissions for a Registry

Discus and support How do I use PowerShell commands to change Permissions for a Registry in Windows 10 Support to solve the problem; Hi, everyone I found the PowerShell command codes could deny full control permission of registry key, but them were imperfect and not met my need. The... Discussion in 'Windows 10 Support' started by shiwan0804, Oct 29, 2020.

  1. How do I use PowerShell commands to change Permissions for a Registry


    Hi, everyone
    I found the PowerShell command codes could deny full control permission of registry key, but them were imperfect and not met my need.
    The imperfect PowerShell command codes are as following.

    $path = "HKCU:\Control Panel\Keyboard"
    $Acl = Get-ACL $path
    $AccessRule= New-Object System.Security.AccessControl.RegistryAccessRule("Administrators","FullControl","Deny")
    $Acl.SetAccessRule($AccessRule)
    Set-Acl $path $Acl

    The perfect state should be as first picture as attached.

    How do I use PowerShell commands to change Permissions for a Registry [​IMG]


    The real condition was as second picture as attached.

    How do I use PowerShell commands to change Permissions for a Registry [​IMG]


    Q1. Could you correct the imperfect command codes to meet my need?
    Q2. Could you put them together and use batch file to run them automatically?
    Thanks a lot.

    :)
     
    shiwan0804, Oct 29, 2020
    #1

  2. How do I use PowerShell commands to change Permissions for a Registry?

    Hi, everyone
    My main objective is make the registry key "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2"
    more safer and not auto run programs.

    Secondly, I hoped the PowerShell command codes could batch run them automatically.

    Protected the registry key before:

    How do I use PowerShell commands to change Permissions for a Registry [​IMG]

    After protected the registry key:

    How do I use PowerShell commands to change Permissions for a Registry [​IMG]


    I had some PowerShell command codes about the aforementioned registry key.
    $path = "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2"
    $Acl = Get-ACL $path
    $AccessRule= New-Object System.Security.AccessControl.RegistryAccessRule("Everyone","FullControl","Deny")
    $Acl.SetAccessRule($AccessRule)
    Set-Acl $path $Acl

    Q.Could you please help me to correct them and tell me what command codes used to batch run them automatically.

    Thanks a lot.
     
    shiwan0804, Oct 29, 2020
    #2
  3. What are the PowerShell command codes could change the registry key?

    Hi, everyone
    I want to change the permission to deny the registry key such as the picture attached as following.
    Firstly, I want to add a new user named as "everyone".
    Secondly, I want to change the permission of everyone to "deny full control".
    I want to use PowerShell to finish aforementioned jobs.
    Could anyone please teach me the PowerShell command codes to finish them?
    Thanks a lot.
    OS: Windows 10 x64 ver. 2004

    How do I use PowerShell commands to change Permissions for a Registry [​IMG]
     
    shiwan0804, Oct 29, 2020
    #3
  4. How do I use PowerShell commands to change Permissions for a Registry

    Locked Powershell startup command in context menu

    This solved my not being able to disable the 2 powershell scripts but why are they there in the first place?
     
    kieronredmond, Oct 29, 2020
    #4
Thema:

How do I use PowerShell commands to change Permissions for a Registry

Loading...
  1. How do I use PowerShell commands to change Permissions for a Registry - Similar Threads - PowerShell commands change

  2. Powershell command to change application advance security settings in registry.

    in Windows 10 Customization
    Powershell command to change application advance security settings in registry.: In order to collect application data in the security audit logs for EventViewer the application permissions in the registry need to be adjusted. I have done this manually and have it working with Azure Sentinel. I need to deploy this across the entire range of assigned...
  3. How do I use PowerShell commands to change Permissions for a Registry?

    in Windows 10 Support
    How do I use PowerShell commands to change Permissions for a Registry?: Hi, everyone My main objective is make the registry key "HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2" more safer and not auto run programs. Secondly, I hoped the PowerShell command codes could batch run them automatically. Protected the...
  4. What are the PowerShell command codes could change the registry key?

    in Windows 10 Support
    What are the PowerShell command codes could change the registry key?: Hi, everyone I want to change the permission to deny the registry key such as the picture attached as following. Firstly, I want to add a new user named as "everyone". Secondly, I want to change the permission of everyone to "deny full control". I want to use PowerShell to...
  5. How to change DNS server using Command Prompt and PowerShell

    in Windows 10 News
    How to change DNS server using Command Prompt and PowerShell: [ATTACH]If you want to change the DNS server using Command Prompt or Windows PowerShell, […] This article How to change DNS server using Command Prompt and PowerShell first appeared on TheWindowsClub.com. read more...
  6. How do i change Powershell to be the default Command Prompt in windows 10?

    in Windows 10 Customization
    How do i change Powershell to be the default Command Prompt in windows 10?: I want to change PowerShell to the default Command Prompt, how? https://answers.microsoft.com/en-us/windows/forum/all/how-do-i-change-powershell-to-be-the-default/f08e9af4-d3f8-4a16-8fda-643088d8d3d5
  7. Change Registry-Key with Powershell

    in Windows 10 Support
    Change Registry-Key with Powershell: Hi Forum I have a Problem with changing Registry-Keys with PowerShell. I use the following entry: $path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers \StorageOnArrival" Set-ItemProperty -Path $path -Name Default -Value...
  8. Change Registry-Key with Powershell

    in Windows 10 Performance & Maintenance
    Change Registry-Key with Powershell: Hi Forum I have a Problem with changing Registry-Keys with PowerShell. I use the following entry: $path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\UserChosenExecuteHandlers \StorageOnArrival" Set-ItemProperty -Path $path -Name Default -Value...
  9. How to change a file's permission through powershell or command prompt

    in User Accounts and Family Safety
    How to change a file's permission through powershell or command prompt: Is there a way to make a file get executed automatically as admin through command prompt or powershell? Lets say there is a file.exe and I want to tick that box that says "execute as administrator" without right clicking the file and doing it through the user interface....
  10. How to change a file's permission through powershell or command prompt

    in Windows 10 Support
    How to change a file's permission through powershell or command prompt: Is there a way to make a file get executed automatically as admin through command prompt or powershell? Lets say there is a file.exe and I want to tick that box that says "execute as administrator" without right clicking the file and doing it through the user interface....