none
Move Computer based on site code , powershell script RRS feed

  • Question

  • Hello

    I need help creating a script that can move my computers to the right organizational unit

    All my computers are named as follows: D (for desktop) + Site Code (4 numbers) + Computer Number (2 numbers) ===> D.0000.01

    D000001 to P000010 ===> Site A
    P001001 to P001010 ===> Site B
    P002001 to P002010 ===> Site C

    I need a PowerShell script that does the following:
    1- Find all Active computers in AD that are not servers or domain controller
    2- Depending on the site code, move the computers to the correct organizational unit
    3- If the computer is already in the correct organizational unit, do not do anything.

    Examples :

    --------------

    Computers named P000001 till P000010 MUST BE moved to CN=Site A, DC=test,DC=IT

    Computers named P001001 till P001010 MUST BE moved to CN=Site B, DC=test,DC=IT

    Computers named P002001 till P002010 MUST BE moved to CN=Site C, DC=test,DC=IT

    Thanks







    partager

    Monday, August 26, 2019 9:57 AM

All replies