Skip to content

Instantly share code, notes, and snippets.

@devomman
Created May 30, 2023 11:01
Show Gist options
  • Star 73 You must be signed in to star a gist
  • Fork 11 You must be signed in to fork a gist
  • Save devomman/7b7bb1d156a9099a10a7be4ad55e3002 to your computer and use it in GitHub Desktop.
Save devomman/7b7bb1d156a9099a10a7be4ad55e3002 to your computer and use it in GitHub Desktop.
Office Activation Command by Omman

Office 2021

Method 1: Using my command line

Step 1.1: Open cmd program with administrator rights.

  • First, you need to open cmd in the admin mode, then run all commands below one by one.

Step 1.2: Get into the Office directory in cmd.

  • For x86 and x64
cd /d %ProgramFiles(x86)%\Microsoft Office\Office16
cd /d %ProgramFiles%\Microsoft Office\Office16
  • If you install your Office in the ProgramFiles folder, the Office directory depends on the architecture of your OS. If you are not sure of this issue, just run both of the commands above. One of them will be not executed and an error message will be printed on the screen.

Step 1.3: Install Office 2021 volume license.

for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x"
  • This step is required. You can not install the KMS client product key of Office without a volume license.

Step 1.4: Activate your Office using the KMS key.

  • Make sure your device is connected to the internet, then run the following commands.
cscript ospp.vbs /setprt:1688
cscript ospp.vbs /unpkey:6F7TH >nul
cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH
cscript ospp.vbs /sethst:e8.us.to
cscript ospp.vbs /act
  • If you see the error 0xC004F074, it means that your internet connection is unstable or the server is busy. Please make sure your device is online and try the command “act” again until you succeed.

Here is all the text you will get in the command prompt window

C:\Windows\system32>cd /d %ProgramFiles(x86)%\Microsoft Office\Office16
The system cannot find the path specified.

C:\Windows\system32>cd /d %ProgramFiles%\Microsoft Office\Office16

C:\Program Files\Microsoft Office\Office16>for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%x"

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /inslic:"..\root\Licenses16\ProPlus2021VL_KMS_Client_AE-ppd.xrm-ms"
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
Installing Office license: ..\root\licenses16\proplus2021vl_kms_client_ae-ppd.xrm-ms
Office license installed successfully.
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /inslic:"..\root\Licenses16\ProPlus2021VL_KMS_Client_AE-ul-oob.xrm-ms"
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
Installing Office license: ..\root\licenses16\proplus2021vl_kms_client_ae-ul-oob.xrm-ms
Office license installed successfully.
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /inslic:"..\root\Licenses16\ProPlus2021VL_KMS_Client_AE-ul.xrm-ms"
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
Installing Office license: ..\root\licenses16\proplus2021vl_kms_client_ae-ul.xrm-ms
Office license installed successfully.
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /setprt:1688
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
Successfully applied setting.
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /unpkey:6F7TH >nul

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
<Product key installation successful>
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /sethst:e8.us.to
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
Successfully applied setting.
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>cscript ospp.vbs /act
Microsoft (R) Windows Script Host Version 5.812
Copyright (C) Microsoft Corporation. All rights reserved.

---Processing--------------------------
---------------------------------------
Installed product key detected - attempting to activate the following product:
SKU ID: cd18ecc0-466a-45d4-8d2e-8c4fa48ae591
LICENSE NAME: Office 21, Office21ProPlus2021R_Grace edition
LICENSE DESCRIPTION: Office 21, RETAIL(Grace) channel
Last 5 characters of installed product key: PG343
ERROR CODE: 0xC004F017
ERROR DESCRIPTION: The Software Licensing Service reported that the license is not installed.
---------------------------------------
Installed product key detected - attempting to activate the following product:
SKU ID: fbdb3e18-a8ef-4fb3-9183-dffd60bd0984
LICENSE NAME: Office 21, Office21ProPlus2021VL_KMS_Client_AE edition
LICENSE DESCRIPTION: Office 21, VOLUME_KMSCLIENT channel
Last 5 characters of installed product key: 6F7TH
<Product activation successful>
---------------------------------------
---------------------------------------
---Exiting-----------------------------

C:\Program Files\Microsoft Office\Office16>

Congratulations! The activation was completed successfully.

==========================================

Method 2: Using my pre-written batch script

Step 2.1: Copy the script code below into a new text document.

@echo off
title Activate Microsoft Office 2021 (ALL versions) for FREE - devomman.com&cls&echo =====================================================================================&echo #Project: Activating Microsoft software products for FREE without additional software&echo =====================================================================================&echo.&echo #Supported products:&echo - Microsoft Office Standard 2021&echo - Microsoft Office Professional Plus 2021&echo.&echo.&(if exist "%ProgramFiles%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles%\Microsoft Office\Office16")&(if exist "%ProgramFiles(x86)%\Microsoft Office\Office16\ospp.vbs" cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16")&(for /f %%x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16\%%x" >nul)&echo.&echo =====================================================================================&echo Activating your product...&cscript //nologo slmgr.vbs /ckms >nul&cscript //nologo ospp.vbs /setprt:1688 >nul&cscript //nologo ospp.vbs /unpkey:6F7TH >nul&set i=1&cscript //nologo ospp.vbs /inpkey:FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH >nul||goto notsupported
:skms
if %i% GTR 10 goto busy
if %i% EQU 1 set KMS=kms7.devomman.com
if %i% EQU 2 set KMS=e8.us.to
if %i% EQU 3 set KMS=e9.us.to
if %i% GTR 3 goto ato
cscript //nologo ospp.vbs /sethst:%KMS% >nul
:ato
echo =====================================================================================&echo.&echo.&cscript //nologo ospp.vbs /act | find /i "successful" && (echo.&echo =====================================================================================&echo.&echo #Please feel free to contact me at devomman@gmail.com if you have any questions or concerns.&echo.&echo #Please consider supporting this project: donate to my paypal devomman@gmail &echo #Your support is helping me keep my servers running 24/7!&echo.&echo =====================================================================================&choice /n /c YN /m "Would you like to visit my blog [Y,N]?" & if errorlevel 2 exit) || (echo The connection to my KMS server failed! Trying to connect to another one... & echo Please wait... & echo. & echo. & set /a i+=1 & goto skms)
explorer "http://devomman.com"&goto halt
:notsupported
echo =====================================================================================&echo.&echo Sorry, your version is not supported.&echo.&goto halt
:busy
echo =====================================================================================&echo.&echo Sorry, the server is busy and can't respond to your request. Please try again.&echo.
:halt
pause >nul

Step 2.2: Save this text file as a cmd file. (Eg. office.cmd).

Step 2.3: Run the cmd file in admin mode.

Step 2.4: Check the activation status again.

Done! Your product is activated successfully now.

More information:

  • Here is the KMS client key of Office 2021: FXYTK-NJJ8C-GB6DW-3DYQT-6F7TH.

  • The Office 2021 KMS license is valid for 180 days only but it can be renewed automatically so you needn’t worry so much about the period.

  • If you would have any questions or concerns, please leave your comments. I would be glad to explain in more details. Thank you so much for all your feedback and support!

@Mahamed-Elredeny
Copy link

thanks ^^

@devomman
Copy link
Author

@kiddohack @Mahamed-Elredeny Most Welcome Kindly Follow me on https://github.com/devomman I try open for more sources.

@KRESSDANIIL
Copy link

I just reinstalled the system and none of the two commands work:
cd /d %ProgramFiles(x86)%\Microsoft Office\Office16
cd /d %ProgramFiles%\Microsoft Office\Office16

@devomman
Copy link
Author

@KRESSDANIIL It will work only if you have the Office 2021 Pro Plus Version Installed not with 365 Version. Also Please Goto ProgramFiles%\Microsoft Office\Office16 this folder manually to verify first the office has already installed or not. I hope it's clear now, Thanks.

@LucianPrime
Copy link

@devomman Hi there. It hasnt worked for me either. I am running the script in Admin mode and I checked ProgramFiles%\Microsoft Office\Office16 folder and its there.
image

@devomman
Copy link
Author

@LucianPrime It will work only if you have the Office 2021 Pro Plus Version Installed not with Other Version. Also try activate with internet without internet it will not work if you have Office 2021 Pro Plus Version

@kiddohack
Copy link

kiddohack commented Feb 27, 2024

@LucianPrime It will work only if you have the Office 2021 Pro Plus Version Installed not with Other Version. Also try activate with internet without internet it will not work if you have Office 2021 Pro Plus Version

Actually, I have a old installer of Office 365 (Setup-X64-365 ProPlus Retail), it is not cracked, it’s Microsoft genuine. And your code worked perfectly after installing Office.

@Sundot1234
Copy link

its very good thanks

@apacheit2
Copy link

damn, i researched nearly 1 month trying to activate ltsc 2021 pro plus and finallyy found this and it worked!!!! no cap.

@gnsdev23
Copy link

gnsdev23 commented Mar 6, 2024

It worked, but am a bit confused...
I have a bunch of MAK keys from our Portal for this product and none of them worked.
These steps worked witht the KMS Key you have provided.
What is happening? Did I miss how MS is going on about these activations?

@apacheit2
Copy link

if the product expires, can i go again with this??

@nunomdias
Copy link

if the product expires, can i go again with this??

Yes. you just need a new KMS server to validate your licence.
The licence is valid for 180 days.

@nunomdias
Copy link

It worked, but am a bit confused... I have a bunch of MAK keys from our Portal for this product and none of them worked. These steps worked witht the KMS Key you have provided. What is happening? Did I miss how MS is going on about these activations?

MAK and KMS are two diferent activation system.
Multiple Activation Key (MAK) activates systems on a one-time basis, using Microsoft's hosted activation.
The Key Management Service (KMS) activate systems on kms server outside Microsoft network.

@mynameisSivaBharath
Copy link

Thank you so much brother, i was literally tried many methods nothing worked, but you helped me with your code ,
Thank you so much brother !

@samkhushal
Copy link

hey, i did those steps and it worked for me at least on paper. I dont know if i got the free version or not because i had created a developers account to get free 6 months i guess and now it has expired i get this msg which still comes even after activating it.
Screenshot_20240310_201412
i dont know if i have to re-login or restart my laptop but i think i am missing something please help!

@Skippa123
Copy link

D6AAA936-6531-4E6A-82EC-067E4B8111B0

@hamzaaouni
Copy link

it works

@Delroy09
Copy link

Thanks mate! dropped a star for ya

@sona9071
Copy link

sona9071 commented Apr 3, 2024

you are awesome!

@koojennie
Copy link

OMG THANK YOU SO MUCH i searched so many tutorials for 5 hours but you're the only one that worked! thanks bro !!!

@elnahehles
Copy link

I bought from office 2021 pro plus (excell, word and other products), good price for retail keys from microsoft partner, key work all country

@Dzombache
Copy link

I'm geting the error 0x80080005 every time. Tried both methods, second one gives 'connection to my KMS server failed' over and over.

Any help?

@ArteKaysa
Copy link

it works, thanks

@lipton329
Copy link

I bought from office 2021 pro plus (excell, word and other products), good price for retail keys from microsoft partner, key work all country

Thanks! bought win office 2021 pro plus, key retail!

@BINIAHMED
Copy link

damn, this worked just fine!

@Skippa123
Copy link

After entering C:\Program Files\Microsoft Office\Office16>for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16%x"
I am given an error code and error description(The software licensing service reported that the action requires administrator privilege. Does anyone have an idea on fixing this issue.It would really help me a lot.

@Delroy09
Copy link

After entering C:\Program Files\Microsoft Office\Office16>for /f %x in ('dir /b ..\root\Licenses16\ProPlus2021VL_KMS*.xrm-ms') do cscript ospp.vbs /inslic:"..\root\Licenses16%x" I am given an error code and error description(The software licensing service reported that the action requires administrator privilege. Does anyone have an idea on fixing this issue.It would really help me a lot.

Right click run it as Administrator

@albymvishak
Copy link

albymvishak commented Apr 26, 2024

if the product expires, can i go again with this??

Yes. you just need a new KMS server to validate your licence. The licence is valid for 180 days.

For that, should we need different cmd lines?
When you say different KMS server, how do we identify or differentiate that we are running on a different KMS server.?

Much appreciate your answer on this!!

@sandy1443
Copy link

Thanks man it work very very thanku

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment