To activate Office 2024 from Command Prompt, open Command Prompt as administrator, go to the Office folder with cd "C:\Program Files\Microsoft Office\Office16", install your key with cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX, then run cscript ospp.vbs /act. Check the result with cscript ospp.vbs /dstatus: it should say LICENSE STATUS: —LICENSED—. No internet on the PC? Use /dinstid and /actcid instead of /act.
/inpkey (install the key), /act (activate) and /dstatus (check).Activating Office 2024 normally takes one click: open Word, enter your key, done. But that doesn’t always work. The activation wizard might not appear, Office might stay stuck on Unlicensed Product, the PC might be offline, or you might be an IT admin activating dozens of machines at once.
That’s when the command line comes in. This guide shows you exactly how to activate Office 2024 using Command Prompt and ospp.vbs, step by step: online, offline and with KMS. It explains how to read the results, lists every useful ospp.vbs command, and gives fixes for the error codes you’re most likely to see.
| Office edition | Use ospp.vbs? | Notes |
|---|---|---|
| Office LTSC Professional Plus 2024 | Yes | Volume licence (MAK or KMS). This is what ospp.vbs was built for. |
| Office LTSC Standard 2024 | Yes | Volume licence, same commands as Professional Plus. |
| Office Home 2024 / Home & Business 2024 | Sometimes | Works if the copy uses a product key. Most are linked to a Microsoft account instead. |
| Project 2024 and Visio 2024 (volume) | Yes | Each has its own key. Install and activate it the same way. |
| Microsoft 365 apps | No | Activated by signing in. Microsoft says to use vnextdiag.ps1 for diagnostics instead. |
What Is ospp.vbs?
ospp.vbs stands for Office Software Protection Platform script. It’s a small Visual Basic script that Microsoft includes with every desktop version of Office, from Office 2010 to Office 2024. It talks directly to the licensing service on your PC, so it can install keys, activate, show licence status and set up KMS without opening a single Office app.
It’s the Office equivalent of slmgr.vbs for Windows. According to Microsoft’s documentation, it only changes Office licences; Windows activation is untouched. It runs through cscript.exe, which is built into Windows.
Before You Start
Find where ospp.vbs is on your PC
Office 2024 keeps ospp.vbs in the Office16 folder, the same as Office 2016, 2019 and 2021. Which Program Files folder depends on whether Office is 64-bit or 32-bit:
| Your Office 2024 | Folder containing ospp.vbs |
|---|---|
| 64-bit Office 2024 (the default) | C:\Program Files\Microsoft Office\Office16 |
| 32-bit Office 2024 on 64-bit Windows | C:\Program Files (x86)\Microsoft Office\Office16 |
| If neither works | C:\Program Files\Microsoft Office\root\Office16 |
Not sure which you have? Open Word, go to File › Account › About Word, and the first line ends with 64-bit or 32-bit.
Open Command Prompt as administrator
Select Start, type cmd, then right-click Command Prompt and choose Run as administrator. Select Yes when Windows asks for permission. The window title should start with Administrator:. If it doesn’t, every activation command will fail.
How to Activate Office 2024 Using Command Prompt (Online)
This is the standard method for a PC with internet. Run each command in order in your administrator Command Prompt.
Step 1: Go to the Office folder
cd "C:\Program Files\Microsoft Office\Office16"
Use the Program Files (x86) path from the table above if you have 32-bit Office. The prompt changes to show the folder you’re in.
Step 2: Check the current licence
cscript ospp.vbs /dstatus
This shows any key that’s already installed, its licence channel and its status. Note the last five characters of any key you’re replacing. If you see No installed product keys detected, go straight to Step 4.
Step 3: Remove an old or trial key (if there is one)
cscript ospp.vbs /unpkey:7H8Q9
Replace 7H8Q9 with the last five characters from your /dstatus output. This step matters when a PC came with a trial or a key that no longer works; otherwise Office may keep trying the old one. Our guide to changing the Office product key without reinstalling covers this in more detail.
Step 4: Install your Office 2024 product key
cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
Type your 25-character key, including the dashes. You should see <Product key installation successful>.
Step 5: Activate Office 2024
cscript ospp.vbs /act
Office contacts Microsoft’s activation servers. After a few seconds you should see <Product activation successful>.
Step 6: Confirm Office 2024 is activated
cscript ospp.vbs /dstatus
Look for LICENSE STATUS: —LICENSED— and the last five characters of your new key. You can also open Word and go to File › Account, which should now say Product Activated.
How to Activate Office 2024 Offline (No Internet)
If the PC can’t go online, activate it with an Installation ID and a Confirmation ID. Phone activation used to handle the middle step, but Microsoft replaced it with an online Product Activation Portal in December 2025, so you’ll need a phone or another device with internet. Microsoft explains the portal in its guide to activating perpetual products using the Product Activation Portal.
cscript ospp.vbs /inpkey: followed by your key, as in the online method.cscript ospp.vbs /dinstid. Write down the long number shown for Office 24.cscript ospp.vbs /actcid: followed by the Confirmation ID, with no spaces or dashes.cscript ospp.vbs /dstatus and look for LICENSED.The portal steps are the same whether you’re activating Office or Windows. Our guide to activating Windows Server without internet shows each portal screen in detail.
How to Activate Office LTSC 2024 With KMS
Businesses with volume licensing often activate Office LTSC 2024 against a KMS host on their own network instead of contacting Microsoft from every PC. Volume installs of Office LTSC 2024 come with a KMS client key (GVLK) already installed, so usually you only need to point Office at the host.
/inpkey:.cscript ospp.vbs /sethst:kms.yourcompany.local, using your KMS server’s name or IP address.cscript ospp.vbs /setprt:1688.cscript ospp.vbs /act.cscript ospp.vbs /dhistorykms to see when the PC last contacted the host.A few things to know about KMS: the KMS host must have the Office LTSC 2024 volume licence pack installed and activated, KMS activation lasts 180 days and renews automatically when the PC can reach the host, and a KMS host only starts activating Office once at least 5 clients have contacted it. On domain networks, Active Directory-based activation can replace KMS entirely.
One-Click Activation Script and Remote PCs
Activate Office 2024 with a batch file
If you activate Office often, save these lines in Notepad as activate-office-2024.bat, replace the X’s with your key, then right-click the file and select Run as administrator. It finds the right folder for 32-bit or 64-bit Office automatically:
@echo off
cd /d "%ProgramFiles%\Microsoft Office\Office16" 2>nul
if not exist ospp.vbs cd /d "%ProgramFiles(x86)%\Microsoft Office\Office16"
cscript //nologo ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
cscript //nologo ospp.vbs /act
cscript //nologo ospp.vbs /dstatus
pause
The //nologo switch hides the Windows Script Host banner so the results are easier to read, and pause keeps the window open so you can check for LICENSED.
Activate Office on another PC on your network
ospp.vbs can activate a remote computer by adding its name after the command. Microsoft’s example looks like this:
cscript ospp.vbs /inpkey:XXXXX-XXXXX-XXXXX-XXXXX-XXXXX PC-NAME
cscript ospp.vbs /act PC-NAME
You need administrator rights on the remote PC, and Windows Firewall on it must allow WMI traffic. Add a username and password after the computer name if your current account isn’t an administrator there.
How to Read the ospp.vbs /dstatus Output
The /dstatus output looks technical, but only four lines matter:
/dstatus for an activated copy of Office LTSC Professional Plus 2024.ospp.vbs Command Reference
These are the ospp.vbs options you’re most likely to need for Office 2024. Every one starts with cscript ospp.vbs. The full list is in Microsoft’s volume activation tools documentation, or run cscript ospp.vbs /?.
| Command | What it does |
|---|---|
/act | Activate the installed Office product keys online. |
/inpkey:key | Install a product key, replacing any existing key for that product. |
/unpkey:XXXXX | Remove a product key, using its last five characters from /dstatus. |
/dstatus | Show licence information for installed product keys. |
/dstatusall | Show licence information for every installed licence. |
/dinstid | Show the Installation ID for offline activation. |
/actcid:ID | Activate offline with a Confirmation ID. |
/dhistoryacterr | Show the failure history for retail and MAK activation. |
/ddescr:code | Explain an error code, for example /ddescr:0xC004F074. |
/rearm | Reset the licensing status for all installed Office products. |
/sethst:host | Set the KMS host name or IP address. |
/setprt:port | Set the KMS port (default 1688). |
/remhst | Remove the KMS host name and reset the port. |
/dhistorykms | Show the KMS client activation history. |
/dcmid | Show the PC’s KMS client machine ID (CMID). |
Office 2024 ospp.vbs Error Codes and Fixes
When activation fails, ospp.vbs shows an ERROR CODE and an error description. Run cscript ospp.vbs /ddescr: followed by the code for Microsoft’s explanation. These are the ones that come up most with Office 2024:
cscript .\ospp.vbs in PowerShell.Activation succeeds but Word still says Unlicensed Product? Close every Office app, including Outlook running in the system tray, and reopen them. If it persists, our guide to Office 2024 key not working covers more fixes.
Need an Office 2024 Product Key?
Noxkeys delivers genuine Office 2024 Professional Plus keys instantly by email, ready to activate with the ospp.vbs commands in this guide or through the normal setup screen. Not sure whether you need Office 2024 or a subscription? Our Office 2024 vs Microsoft 365 vs LibreOffice comparison helps you decide.
Browse all Microsoft Office licences, read our FAQ, or contact support with a screenshot of your /dstatus output if activation fails.
Frequently Asked Questions
How do I activate Office 2024 using Command Prompt?
Open Command Prompt as administrator, run cd “C:\Program Files\Microsoft Office\Office16”, then cscript ospp.vbs /inpkey: followed by your product key, and cscript ospp.vbs /act. Check with cscript ospp.vbs /dstatus that the licence status is LICENSED.
Where is ospp.vbs in Office 2024?
In C:\Program Files\Microsoft Office\Office16 for 64-bit Office, or C:\Program Files (x86)\Microsoft Office\Office16 for 32-bit Office on 64-bit Windows. Some installs use C:\Program Files\Microsoft Office\root\Office16.
Does ospp.vbs work for Office 2024 Home and Home & Business?
Only if the copy was activated with a product key. Most consumer copies of Office 2024 are linked to a Microsoft account; for those, /dstatus shows no installed keys and you activate by signing in.
Can I activate Microsoft 365 with ospp.vbs?
No. Microsoft 365 apps activate by signing in with a Microsoft account, and Microsoft says ospp.vbs doesn’t work for them.
How do I activate Office 2024 without internet?
Install the key with /inpkey, run cscript ospp.vbs /dinstid to show the Installation ID, enter it in Microsoft’s Product Activation Portal on another device, then run cscript ospp.vbs /actcid: followed by the Confirmation ID.
Is activating Office 2024 with ospp.vbs legal?
Yes, when you use a genuine product key. ospp.vbs is Microsoft’s own tool and is documented by Microsoft. Using it with unlicensed KMS servers or activator scripts is not legitimate.
Why does ospp.vbs say Input Error: Can not find script file?
You’re not in the folder that contains ospp.vbs, or you’re in PowerShell without .\ before the script name. Move to the correct Office16 folder or run cscript .\ospp.vbs.
How do I check if Office 2024 is activated from Command Prompt?
Run cscript ospp.vbs /dstatus from the Office16 folder. LICENSE STATUS: —LICENSED— means Office 2024 is activated.
What does error 0xC004F074 mean in Office 2024?
The PC couldn’t reach a KMS host. Check the host name with /sethst, make sure port 1688 is open, or install a MAK or retail key and run /act instead.
Can I use the same commands for Office 2021 and 2019?
Yes. Office 2016, 2019, 2021 and 2024 all keep ospp.vbs in the Office16 folder and use the same commands.
