Forum Discussion

pedersench's avatar
pedersench
Copper Contributor
Aug 11, 2022
Solved

Need help with a script for adding computers to AD Security Group

I have exported all computer names to a .csv file and am trying to add these to a security group   This is the script i am trying to run:   $Computers = Get-Content c:\Temp\clients.csv foreach (...
  • LainRobertson's avatar
    LainRobertson
    Aug 11, 2022

    The problem's with the CSV.

     

    If you look at the first error shown - which is reflective of the contents of the CSV, the computer "name" within the error does not include the obligatory dollar sign as the final character, meaning it's not the actual sAMAccountName but simply the common name.

     

    So, where the name from the error "W100135TRO87" does not work, "W100135TRO87$" would work.

     

    Cheers,

    Lain

Resources