Thanks Thanks:  0
Dislikes Dislikes:  0
Page 1 of 3 123 LastLast
Results 1 to 10 of 22
  1. #1
    Technician
    Join Date
    May 2018
    Location
    Sacramento
    Posts
    18
    Rep Power
    12

    Populating the address book

    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.

    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.

  2. #2
    Technician
    Join Date
    May 2018
    Location
    Sacramento
    Posts
    18
    Rep Power
    12

    Re: Populating the address book

    Example output

    Abbreviated name,Destination type,Search key,E-Mail: E-Mail Address,SMB: Host Address,SMB
    "Sean Smith",SMB,search key,sean.brennan@mycompany.net,CRP-SRV-FILE1,user\Sean.smith,CRP-PRT

  3. #3
    Aging Tech 10,000+ Posts
    Populating the address book

    copier addict's Avatar
    Join Date
    Jul 2013
    Location
    Diamond
    Posts
    11,919
    Rep Power
    323

    Re: Populating the address book

    Try Pagescope Data Administrator. With it you are able to manage multiple MFPs at the same time.
    It is a free download from KonMin. Just google it.

  4. #4
    Technician
    Join Date
    May 2018
    Location
    Sacramento
    Posts
    18
    Rep Power
    12

    Re: Populating the address book

    Quote Originally Posted by copier addict View Post
    Try Pagescope Data Administrator. With it you are able to manage multiple MFPs at the same time.
    It is a free download from KonMin. Just google it.
    I have it, but with 60+ copiers I'm hoping to make this a completely automated task.

  5. #5
    Service Manager 2,500+ Posts
    Populating the address book


    Join Date
    Sep 2005
    Location
    South Jersey
    Posts
    3,837
    Rep Power
    133

    Re: Populating the address book

    Depends on the model of the machines.

  6. #6
    Technician
    Join Date
    May 2018
    Location
    Sacramento
    Posts
    18
    Rep Power
    12

    Re: Populating the address book

    Quote Originally Posted by copyman View Post
    Depends on the model of the machines.

    Which ones, and using what utility?


  7. #7
    Technician
    Join Date
    May 2018
    Location
    Sacramento
    Posts
    18
    Rep Power
    12

    Re: Populating the address book

    The latest.....Still a lot of junk code and few test lines.. but its %95 working....

    Code:
    echo
    cls
    Taskkill /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^" OU') do (
        echo =============================Processing OU %%i========================================
        echo Abbreviated name,E-Mail: E-Mail Address,SMB: Host Address,SMB: File Path,SMB: User ID,SMB: Password > "%%i.csv"
        for /f "delims=" %%j in ('adfind ^-soao -b "OU=%%i,OU=Users-Corporate,OU=UserAccounts,DC=mycompany,DC=int" ^-f objectclass^=person ^-list sAMAccountName') do (
            set abbreviated=
            set first=
            set last=
            set destination=SMB
            set mail=
            set password="7EV!9%"
            set smbhost=CRP
            set smbpath=users\
            set smbid=CRP-PRT
            echo  Adding %%j to site %%i
            for /f "delims=" %%k in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" displayName') do set abbreviated=%%k
            for /f "delims=" %%m in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" givenname') do set first=%%m
            for /f "delims=" %%q in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" sn') do set last=%%q
            for /f "delims=" %%r in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" mail') do set mail=%%r
                echo !abbreviated!,!mail!,!smbhost!,!smbpath!!first!.!last!\scans,!smbid!,!password!
            Echo
                echo !abbreviated!,!mail!,!smbhost!,!smbpath!!first!.!last!\scans,!smbid!,!password!>> "%%i.csv"
            )
        rem "C:\Program Files\Microsoft Office 15\root\Office15\excel.exe" "c:\scripts\%%i.csv"      
        )

  8. #8
    Service Manager 1,000+ Posts
    Populating the address book


    Join Date
    Sep 2011
    Location
    Perth, Western Australia
    Posts
    1,894
    Rep Power
    69

    Re: Populating the address book

    Why not enable LDAP search and just print instructions on how to search and register your email address.

  9. #9
    Senior Tech. 2,500+ Posts NeoMatrix's Avatar
    Join Date
    Nov 2010
    Location
    Sunshine State QLD.
    Posts
    3,514
    Rep Power
    104

    Re: Populating the address book

    Quote Originally Posted by SoCi0pAtH View Post
    The latest.....Still a lot of junk code and few test lines.. but its %95 working....

    Code:
    echo
    cls
    Taskkill /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^" OU') do (
        echo =============================Processing OU %%i========================================
        echo Abbreviated name,E-Mail: E-Mail Address,SMB: Host Address,SMB: File Path,SMB: User ID,SMB: Password > "%%i.csv"
        for /f "delims=" %%j in ('adfind ^-soao -b "OU=%%i,OU=Users-Corporate,OU=UserAccounts,DC=mycompany,DC=int" ^-f objectclass^=person ^-list sAMAccountName') do (
            set abbreviated=
            set first=
            set last=
            set destination=SMB
            set mail=
            set password="7EV!9%"
            set smbhost=CRP
            set smbpath=users\
            set smbid=CRP-PRT
            echo  Adding %%j to site %%i
            for /f "delims=" %%k in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" displayName') do set abbreviated=%%k
            for /f "delims=" %%m in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" givenname') do set first=%%m
            for /f "delims=" %%q in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" sn') do set last=%%q
            for /f "delims=" %%r in ('adfind -b ^"OU^=Users^-Corporate^,OU^=UserAccounts^,DC^=mycompany^,DC^=int^" ^-nodn ^-nocsvheader ^-list ^-f ^"sAMAccountName^=%%j^" mail') do set mail=%%r
                echo !abbreviated!,!mail!,!smbhost!,!smbpath!!first!.!last!\scans,!smbid!,!password!
            Echo
                echo !abbreviated!,!mail!,!smbhost!,!smbpath!!first!.!last!\scans,!smbid!,!password!>> "%%i.csv"
            )
        rem "C:\Program Files\Microsoft Office 15\root\Office15\excel.exe" "c:\scripts\%%i.csv"      
        )
    What is the "adfind" trying to execute ?

    Is "adfind" a konmin or macintosh command for searching a string ?
    You appear to be "escaping ^" a lot of strings in the "For /F" function.
    You may be able to reduce the "for function" escapes to a simplified variable set directly.

    Example only . Have you tried using:
    Any string line of text found with adfind "-" will be broken into single tokens at each "-"

    for /f "tokens=1-9, delims=-" %%i do ( 'adfind /sw "any string"' ) do (

    set abbreviated=%%i
    set first= %%j
    set last= %%k
    set destination=%%l
    set mail=%%m
    set password=%%n
    set smbhost=%%o
    set smbpath=%%p
    set smbid=%%q

    )

    Token variables are case sensitive eg. "for /f %%i" is not the same as "for /f %%I"
    Every "for" loop loses all token %%? values once outside the bracket delimits of the "for /f" loop.
    The for %%? are only local vars while inside the "for /f" loop. You cannot access these values, thought it will store the last only value until the batch file terminates with "EndLocal" command.
    Endlocal is automatically implied at the end of the batch file.


    Post a sample/portion of a typical input *.txt or *.csv file to the forum.
    You've already shown the format of the *.csv output file.
    I may get a spare moment to throw some batch code together.
    Last edited by NeoMatrix; 06-08-2018 at 12:25 PM.
    Inauguration to the "AI cancel-culture" fraternity 1997...
    •••••• •••[§]• |N | € | o | M | Δ | t | π | ¡ | x | •[§]••• ••••••

  10. #10
    Technician
    Join Date
    May 2018
    Location
    Sacramento
    Posts
    18
    Rep Power
    12

    Re: Populating the address book

    Quote Originally Posted by rrrohan View Post
    Why not enable LDAP search and just print instructions on how to search and register your email address.
    Using this method to populate the address book means the users can scan to their home directory with about 5 buttons to press. Searching would be atleast 30. Our users complain a lot LOL

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Get the Android App
click or scan for the Copytechnet Mobile App

-= -= -= -= -=


IDrive Remote Backup

Lunarpages Internet Solutions

Advertise on Copytechnet

Your Link Here