Category Archives: Windows

Reset win2k8/2k12 domain admin password

My friend forgot his test lab domain admin password. And he only have a normal user account. So he asked me how can he reset his domain admin password.
It’s easy. Only a few steps

1. Boot the domain controller with a windows 2k8/2k12 installation CD
2. Press shift+f10 to start command line on the fist screen.
3. Run below command:

MOVE E:WindowsSystem32Utilman.exe e:WindowsSystem32Utilman.exe.bak
COPY E:WindowsSystem32cmd.exe e:WindowsSystem32Utilman.exe

You should replace E: with you local disk letter.
4. Restart the DC
5. When DC done booting up again and you are at the Logon screen click on the Ease of access icon. Then you should be able to open a command line.
6. Reset domain admin password

net user administrator *

Done

Install PFX certificate on ESXi host

1. Install OpenSSL version 0.9.8 for windows, you can get it from below link:
http://slproweb.com/download/Win32OpenSSL_Light-0_9_8zb.exe
2. Install it on a windows machine. By default, OpenSSL will be installed to C:OpenSSL
3. Copy the pfx certificates into folder C:OpenSSLbin
4. Run command line as administrator, and go to folder C:OpenSSLBin
5. Use below command to covert the certificate:
a. Generate crypt key file for the certificate via below command:

openssl pkcs12 -in server.pfx -nocerts -out server_tmp.key 

During this step, it will ask for pfx certificate password and the pass phrase for the key. Use any word you like as the pass phrase, do not use blank pass phrase.
Then use below command to decrypt the key. In this step it will ask you the pass phase you used before.

openssl rsa -in server_tmp.key  -out server.key

b. Generate crt file for the certificate via below command:

openssl pkcs12 -in server.infau.wbcau.westpac.com.au.pfx -clcerts -nokeys -out server.crt 

6. Done. Now you can install the certificate for ESXi host

Verify Schema versions on all Domain Controllers

Usually we can use below batch file to check domain controller schema version.

ECHO OFF

REM Change the line below. Example: SET domain=dc=mydomain,dc=com

SET domain=dc=exampledomain,dc=com

ECHO.
ECHO Finding Schema Level on Domain Controllers in domain %domain%..

SET file=schemainput.txt
dsquery server -o rdn > %file%
FOR /f %%a IN (%file%) DO CALL :Loop %%a
REM Cleaning up the temporary file.
IF EXIST %file% DEL %file%
GOTO :eof

:Loop
SET dc=%1
ECHO.
ECHO %dc%
dsquery * cn=schema,cn=configuration,%domain% -scope base -attr objectversion -s %dc%|FIND /i /v "objectversion"
GOTO :eof

Another very quick way to check this with only one command line is using the repadmin tool:

repadmin /showattr * “cn=schema,cn=configuration,dc=yourdomain,dc=com” /atts:ObjectVersio

n

IIS: SSL Certificate Disappearing after import

After import the certificate into IIS, when I navigated away from the Server Certificates window, the certificate would disappear.
I could see the certificate in the server’s Personal Certificate Store using MMC (Microsoft Management Console) but it wouldn’t show up in IIS.

After investigate, I found below solution for this issue:

Save the three portions of the certificate into three separate files (Note: The Intermediate Certificate is optional, if you were not supplied with one, just skip the steps involving it):

privatekey.txt – Copy and paste the contents of the private key including the begin and end lines.
certificate.txt – Copy and paste the contents of the Regular Certificate including the begin and end lines.
intermediate.txt – Copy and paste the contents of the Intermediate Certificate including the begin and end lines.

Upload all these files to a linux server, and run

openssl pkcs12 -export -out certificate.pfx -inkey privatekey.txt -in certificate.txt -certfile intermediate.txt

then import the certificate.pfx into IIS