AD-GetOUMachines.ps1
|
function AD-GetOUMachines { $OU = (Read-Host -p "Enter OU") $OUpath = 'ou=$OU,dc=domain,dc=net' $ExportPath = '\\172.168.0.2\data\computers_in_ou.csv' Get-ADComputer -Filter * -SearchBase $OUpath | Select-object DistinguishedName,DNSHostName,Name | Export-Csv -NoType $ExportPath } |