We have Konica all in one copiers in the office. We heavily use the scan feature and copy the file to the users home drive. With 60+ copiers and 700+ users in 40 offices maintaining the address books on each printer is a daily chore..
My goal is to automate this task as much as possible.
Goal : Query AD for user information to build csv to import. Each office has its own OU in AD, so I should be able to create a seperate csv for each office based upon the OU.
Challenges
1. I'm not able to use the homedir attribute because its populated with a DFS link that the copiers cant support.
2. Each site has its own DFS home dir server/host. Although there is a naming convention there are old servers that dont follow it.
3. Home directories root are different for each site.
4. Each site has its own AD service account to grant access to the users home drive.
This is a NOT working work in progress
The logic goes
1. Query AD for list of OUs (sites)
2. Create a file with the OU name
3. Write column headers
4. Populate user info
5. Repeat until all AD OUs have been processed.
Once I get it working I'm going to write it in Powershell.
Any suggestions for a command line utility to upload the csv's to the printers would be great.
My goal is to automate this task as much as possible.
Goal : Query AD for user information to build csv to import. Each office has its own OU in AD, so I should be able to create a seperate csv for each office based upon the OU.
Challenges
1. I'm not able to use the homedir attribute because its populated with a DFS link that the copiers cant support.
2. Each site has its own DFS home dir server/host. Although there is a naming convention there are old servers that dont follow it.
3. Home directories root are different for each site.
4. Each site has its own AD service account to grant access to the users home drive.
This is a NOT working work in progress
The logic goes
1. Query AD for list of OUs (sites)
2. Create a file with the OU name
3. Write column headers
4. Populate user info
5. Repeat until all AD OUs have been processed.
Code:
clsTaskkill /IM Excel.exe /F setlocal enabledelayedexpansion for /f "delims=" %%i in ('adfind ^-nodn ^-list ^-s one ^-soao ^-f objectclass^=OrganizationalUnit ^-b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" distinguishedname') do ( for /f "delims=" %%v in ('adfind ^-f "%%i" ^-nodn ^-list name') do ( echo Processing OU %%v ) echo Abbreviated name,Destination type,Search key,E-Mail: E-Mail Address,SMB: Host Address,SMB: File Path,SMB: User ID > %%v.csv for /f "delims=" %%j in ('adfind ^-soao ^-f objectclass^=person ^-b ^"%%i^" ^-nodn ^-list sAMAccountName') do ( set abbreviated= set first= set last= set destination=SMB set mail= set smbhost=CRP^-SRV^-FILE1 set smbpath=user\ set smbid=CRP-PRT echo processing AD %%i for /f "delims=" %%k in ('adfind ^-nodn ^-nocsvheader ^-csv ^-f ^"sAMAccountName^=%%j^" displayName') do set abbreviated=%%k for /f "delims=" %%m in ('adfind ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" givenname') do set first=%%m for /f "delims=" %%q in ('adfind ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" sn') do set last=%%q for /f "delims=" %%r in ('adfind ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" mail') do set mail=%%r echo !abbreviated!,!destination!,search key,!mail!,!smbhost!,!smbpath!!first!.!last!,!smbid! echo !abbreviated!,!destination!,,!mail!,!smbhost!,!smbpath!!first!.!last!,!smbid! >> %%v.csv ) start c:\scripts\%%v.csv )
Once I get it working I'm going to write it in Powershell.
Any suggestions for a command line utility to upload the csv's to the printers would be great.
Comment