Unable to figure out the following so I am looking for community help.
I work for a large school system, where all the computers are bound to Active Directory. Technicians are assigned several sites to maintain, in which keeping the Directory free of unused and orphaned devices is one of our assigned tasks. (Computers are a mix of Window and Macs.)
Was trying to figure out a quick and easy way to list computers in my assigned OUs and sub OUs.
So far, this works:
dscl "/Active Directory/All Domains" list /Computers
But it only lists computers in the root OU and Domain Controllers, not my assigned sub OUs.
The code seems to work, returning only ‘returns’ or null lines.
------------------------------------
#!/bin/bash
for i in `dscl /Active\ Directory/All\ Domains -list /Computers` ; do
dscl /Active\ Directory/All\ Domains -read /Computers/9110-dc01$/${i} | awk 'BEGIN {FS=":"} {print $1}'
echo
done
-----------------------------------
Can anyone point me in the right direction?
Something I thought would be easy, isn’t.
Thanks in advance!
~David