Forum Discussion

Surfer10's avatar
Surfer10
Copper Contributor
Jan 21, 2021
Solved

add computers to security group automatically

I would like to add computers in AD with names that start with desktop to a security group: testgroup. We would like to run this powershell command thru scheduled tasks to run every week so that if ...
  • farismalaeb's avatar
    farismalaeb
    Jan 21, 2021

    Surfer10 

    did you add the * after the desktop1

    try this small change

    $AllPC=Get-ADComputer -Filter 'SamAccountName -like "desktop*"'

Resources