powershellactive-directorycifs

Do the PowerShell cmdlets Set-ADComputer and Get-ADComputer work outside of OU=COMPUTER?


I would like to know if Set-ADComputer and Get-ADComputer work only for objects presents inside the OU=Computer or if these cmdlets are compatible with any other location?


Solution

  • These cmdlets work in the whole AD! You may specify single computer, by using parameter -identity:

    The Identity parameter specifies the Active Directory computer to modify. You can identify a computer by its distinguished name, GUID, security identifier (SID) or Security Accounts Manager (SAM) account name. You can also set the Identity parameter to an object variable such as $, or you can pass an object through the pipeline to the Identity parameter. For example, you can use the Get-ADComputer cmdlet to retrieve a computer object and then pass the object through the pipeline to Set-ADComputer.

    or you may use parameter -filter to filter based on a specific criteria, throughout the whole AD, or specify a OU with parameter -SearchBase.

    More details at:

    https://learn.microsoft.com/en-us/powershell/module/addsadministration/set-adcomputer?view=win10-ps

    https://learn.microsoft.com/en-us/powershell/module/addsadministration/get-adcomputer?view=win10-ps