set-aduser property

Hofmann, Wolfgang 21 Reputation points
2022-06-24T14:53:46.65+00:00

i want to do this:

get-aduser test-user | set-aduser -Remove @{msds-sourceanchor = "xxxxx"}

But i get a syntax error as the "-" in "msds-sourceanchor" is not allowed

214885-image.png

Windows for business | Windows Server | User experience | PowerShell
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,901 Reputation points
    2022-06-24T15:03:15.037+00:00

    But that's not what the error message says. Translation: "=" missing after a key in the hashliteral.

    You said you want to do this: set-aduser -Remove @{msds-sourceanchor = "xxxxx"}, but you've done this: set-aduser -Remove @{msds-sourceanchor}

    What you need to do is this: @{"msds-sourceanchor" = "xxxx"}

    1 person found this answer helpful.
    0 comments No comments

  2. Hofmann, Wolfgang 21 Reputation points
    2022-06-28T14:21:07.377+00:00

    OK, the quotationmarks did it :-)

    thanks

    kind regards
    Wolfgang


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.