Rick0

SCRIPT_LOGIN_DE_REDE

Mar 12th, 2020
422
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.58 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. TITLE SCRIPT LOGINS DE REDE
  4. pushd "%~dp0"
  5. CLS
  6. ECHO LENDO LISTA.txt E SALVANDO NO ARQUIVO LOGINS.txt AGUARDE...
  7. IF EXIST "%~dp0LOGINS.txt" del /f /q "%~dp0LOGINS.txt"
  8. for /f "tokens=1* delims=" %%G in (LISTA.txt) do (
  9.    for /f "tokens=1* delims=" %%a in ('dsquery user -name "%%G"^ "OU=XXXX,OU=XXXX,DC=SERVIDOR,DC=com,DC=br"^|dsget user -samid ^| find /v "samid" ^| find /v "dsget"') do (
  10.       SET "_USER=%%a"
  11.       SET USER=!_USER: =!
  12.    )
  13.    ECHO %%G,!USER!>>LOGINS.txt
  14.    SET "USER="
  15. )
  16. CLS
  17. ECHO CONCLUIDO...
  18. popd
  19. ::explorer "%~dp0"
  20. EXIT
Advertisement
Add Comment
Please, Sign In to add comment