Adding Network Service account (hostname$) to a security group via powershell

%3CLINGO-SUB%20id%3D%22lingo-sub-927721%22%20slang%3D%22en-US%22%3EAdding%20Network%20Service%20account%20(hostname%24)%20to%20a%20security%20group%20via%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-927721%22%20slang%3D%22en-US%22%3E%3CP%3EHi%20Team%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWould%20anyone%20know%20how%20you%20can%20add%20hostname%24%20via%20powershell%20to%20a%20security%20group%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EGreatly%20appreciate%20the%20help%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-927721%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-956270%22%20slang%3D%22en-US%22%3ERe%3A%20Adding%20Network%20Service%20account%20(hostname%24)%20to%20a%20security%20group%20via%20powershell%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-956270%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F191710%22%20target%3D%22_blank%22%3E%40John%20Cilluffo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIf%20you%20looking%20to%20add%20in%20Active%20Directory%20security%20group%2C%20you%20can%20use%20the%20below%20command.%3C%2FP%3E%3CPRE%3EADD-ADGroupMember%20%22SecurityGroup%22%20%E2%80%93members%20%22hostname%24%22%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hi Team,

 

Would anyone know how you can add hostname$ via powershell to a security group?

 

Greatly appreciate the help

 

Thank you

1 Reply
Highlighted

@John Cilluffo 

 

If you looking to add in Active Directory security group, you can use the below command.

ADD-ADGroupMember "SecurityGroup" –members "hostname$"