locked
Local Administrator Group Changes Powershell RRS feed

  • Question

  • Hello all. I'm still somewhat new to powershell and I am trying to figure out something. I found the script How to Get Notified of Local Administrator Group Changes with Powershell on MS TechNet (How to Get Notified of Local Administrator Group Changes with Powershell).  I'm trying to figure out if you can query an Active Directory OU container for PC host names rather than inputting all hostnames or using a text file. Any help would be appreciated. Thank you in advanced!  
    Thursday, October 13, 2016 1:39 PM

Answers

  • You will need to combine tools. Here is a sample PowerShell command that creates a text file containing all the computers in an OU:


    Get-ADComputer -Filter * -SearchBase 'OU=Sales,DC=fabrikam,DC=com' | Select-Object -ExpandProperty Name | Out-File MyTextFile.txt


    -- Bill Stewart [Bill_Stewart]

    Thursday, October 13, 2016 2:18 PM