Search code examples
windowspowershellsecuritygroup-policy

How to restrict unauthenticated RPC clients using powershell


The manual way to solve this is: Local Group Policy Editor > Computer Configuration > Administrative Templates > System > Remote Procedure Call > Change “Restrict Unauthenticated RPC clients” to configured and authenticated.

But I want to be able to script this into powershell.


Solution

  • You can update the corresponding registry setting. Check out the admx.help page on that policy for information about which values to use:

    Set-ItemProperty "HKLM:\Software\Policies\Microsoft\Windows NT\Rpc" -Name RestrictRemoteClients -Value 2
    

    If the reg key doesn't already exist, then you may have to create it with New-Item and/or New-ItemProperty instead.