Weblogic 9.2和10.3 改密碼 一站完成

rgqancy發表於2013-07-31

Weblogic 9.2和10.3可通用,只需修改參照如下配置即可:

SET BEA_HOME=F:\bea
SET JRE_HOME=%BEA_HOME%\jdk150_04\bin
SET LIB_HOME=%BEA_HOME%\weblogic92\server\lib

rem SET BEA_HOME=D:\bea
rem SET JRE_HOME=%BEA_HOME%\jdk160_11\bin
rem SET LIB_HOME=%BEA_HOME%\wlserver_10.3\server\lib

SET DOMAIN_HOME=%BEA_HOME%\user_projects\domains\base_domain
SET SECURITY_HOME=%DOMAIN_HOME%\security
SET SERVERS_SECURITY_HOME=%DOMAIN_HOME%\servers\AdminServer\security

SET USERNAME=weblogic
SET PASSWROD=weblogicbwhk

SET EDIT_TOOL="C:\Program Files\Notepad++\notepad++.exe"

@ECHO OFF
for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldtstr=%ldt:~0,4%_%ldt:~4,2%_%ldt:~6,2%_%ldt:~8,2%_%ldt:~10,2%_%ldt:~12,2%_%ldt:~15,3%

TASKKILL /F /IM %JRE_HOME%\java.exe

CD %DOMAIN_HOME%\bin
CALL %DOMAIN_HOME%\bin\setDomainEnv.cmd

COPY %SECURITY_HOME%\DefaultAuthenticatorInit.ldift %SECURITY_HOME%\DefaultAuthenticatorInit.ldift.%ldtstr%.bak

CD %SECURITY_HOME%
%JRE_HOME%\java.exe -cp %LIB_HOME%\weblogic.jar weblogic.security.utils.AdminAccount %USERNAME% %PASSWROD% .

REN %DOMAIN_HOME%\servers\AdminServer\data data.%ldtstr%.bak

ECHO OFF
ECHO 請修改即將開啟的boot.properties檔案中的使用者名稱與密碼。示例如下:
ECHO username=%USERNAME%
ECHO password=%PASSWROD%
ECHO ON
PAUSE

COPY %SERVERS_SECURITY_HOME%\boot.properties %SERVERS_SECURITY_HOME%\boot.properties.%ldtstr%.bak
%EDIT_TOOL% %SERVERS_SECURITY_HOME%\boot.properties

相關文章