Skip to content

Instantly share code, notes, and snippets.

@nrchandan
Created August 8, 2020 17:49
Show Gist options
  • Save nrchandan/4cc371b8756ec38809c3fb2ca32a33cf to your computer and use it in GitHub Desktop.
Save nrchandan/4cc371b8756ec38809c3fb2ca32a33cf to your computer and use it in GitHub Desktop.
$acl = Get-Acl C:\ProgramData\ssh\administrators_authorized_keys
$acl.SetAccessRuleProtection($true, $false)
$administratorsRule = New-Object system.security.accesscontrol.filesystemaccessrule("Administrators","FullControl","Allow")
$systemRule = New-Object system.security.accesscontrol.filesystemaccessrule("SYSTEM","FullControl","Allow")
$acl.SetAccessRule($administratorsRule)
$acl.SetAccessRule($systemRule)
$acl | Set-Acl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment