locked
Add accounts with $ RRS feed

  • Question

  • Hi

    I want add account with format 'domain\username$' in a ACL, but i have problem with this sentence:

    icacls "path" /grant "domain\username$":M (i try replace \´$, `$, and don`t work)

    and try this:

    $acl = Get-Acl "Path"

    $rule = New-Object System.Security.AccessControl.FileSystemAccessRule("domain\username$","FullControl", "ContainerInherit, ObjectInherit", "None", "Allow")

    PS IIS:\Sites> $acl.AddAccessRule($rule)

    but don´t work either

    Any help?

    Thanks you!

    Wednesday, August 1, 2018 11:25 AM

Answers

  • Use single quotes:


    PS C:\> icacls "path" /grant 'domain\username$:M'

    The help topic about_Quoting_Rules is helpful here.


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Bill_Stewart Tuesday, December 11, 2018 10:18 PM
    Wednesday, August 1, 2018 2:42 PM

All replies

  • The PowerShell escape character is the backtick, "`". This is not an apostrophe, single quote, or fancy slanted single quote.

    Edit: On all of my keyboards the backtick, "`", is on the same key as the tilde character, "~". It is also the line continuation character in PowerShell, if that helps.


    Richard Mueller - MVP Enterprise Mobility (Identity and Access)


    Wednesday, August 1, 2018 2:26 PM
  • Use single quotes:


    PS C:\> icacls "path" /grant 'domain\username$:M'

    The help topic about_Quoting_Rules is helpful here.


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Bill_Stewart Tuesday, December 11, 2018 10:18 PM
    Wednesday, August 1, 2018 2:42 PM