title: Powershell script to query specifc OU in AD for computer names and export
body: <p>I'm pretty much(read completely) a novice with PowerShell and I'm working on a project to inventory installed software on some computers on our network. I dug up a script to handle the software inventory part, but it relies on a text file with computer names to scan. I'm looking for a way to query AD for computer names for specific OU's. Ideally the script would prompt the user to enter the OU and path of text file to export to. Then it would search AD for a match and if found export to the specified path. So for example, to export all computers in OU=Workstations,OU=New York,DC=Fabrikam,DC=com" the user should receive a prompt and enter "New York" and all computer names would be exported to the specfied path.
  Any help would be greatly appreciated.</p>