Selamat datang di netfr13nd zone.
Ini adalah script yg lumayan bagus ?, seluruhnya ada didalam file batch, fungsinya:
- Prompts for input of a user's Full Name and Email Address
- Sets their password to a random string of uppercase, lowercase and numerical characters.
- Generates an email to send to them, with their new password.
Catatan:
- Length of the password can be set using the line Set _RNDLength=
- Whether user has to reset their password on logging in can be set with -mustchpwd
- Amend OU= and DC= for your own companie's domain.
Ini codenya:
@echo off
:Start
endlocal
echo.
echo This script will reset the password for a user, using their Full Name,
echo and then generate the email to be sent to them.
echo.
echo Passwords are automatically set as 10 digits, using lowercase,
echo uppercase and numbers.
echo.
echo.
echo.
set /p "DisplayName= Full Name : %=%"
echo.
echo.
set /p "EmailAddress= Email : %=%"
cls
Setlocal EnableDelayedExpansion
Set _RNDLength=10
Set _Alphanumeric=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
Set _Str=%_Alphanumeric%987654321
:_LenLoop
IF NOT "%_Str:~18%"=="" SET _Str=%_Str:~9%& SET /A _Len+=9& GOTO :_LenLoop
SET _tmp=%_Str:~9,1%
SET /A _Len=_Len+_tmp
SET _count=0
SET _RndAlphaNum=
:_loop
SET /a _count+=1
SET _RND=%Random%
SET /A _RND=_RND%%%_Len%
SET _RndAlphaNum=!_RndAlphaNum!!_Alphanumeric:~%_RND%,1!
If !_count! lss %_RNDLength% goto _loop
dsmod user "CN=%DisplayName%,OU=[OU],DC=[DC],DC=co,DC=uk" -pwd !_RndAlphaNum! -mustchpwd no
IF ERRORLEVEL 0 (
GOTO SendEmail
) ELSE (
echo.
echo Failed.
echo.
Pause
GOTO Start
)
:SendEmail
start "" "mailto:%EmailAddress%?subject=Password%%20Reset&body=Hello,%%0D%%0A%%0D%%0AYour%%20AD%%20password%%20has%%20been%%20reset%%20to%%20!_RndAlphaNum!%%0D%%0A%%0D%%0AKind Regards,%%0D%%0A%%0D%%0AYour%%20Name"
cls
GOTO Start
Email yang dihasilkan terlihat seperti ini;
Hello,
Your AD password has been reset to kD5Xjfd8A6
Kind Regards,
Your Name
Ini menghemat waktu saya di tempat kerja saat kita mendapatkan banyak email yang meminta penyetelan ulang kata sandi untuk akun AD. Membutuhkan waktu 30 detik, bukan beberapa menit.
Quote: "This bengi, the mendung is gumandul on the sky. The gluduks sound jlegar jlegar like mercon. The lightning mak clorot many times. My pemean is miber up to my windows because kesebul the wind. The trees geal geol also almost fall. The rain sound gembrojog nang nduwure roof. It is very mbebayani ! Now, I'm afraid alone while turon turon in my room.
I miss you so much my lovely yayang. Instead of lenger lenger alone, I heard sound of klenengan. I'm getting curigo. I check it out. Damn, it was hot wedang jae seller ! I'm running jumpalitan to the wedang jae seller. Then I call him and tuku sak mug beg. Then I sruput it until entek.
Now I'm heavily mbleneg. Cheers..."