You can activate Microsoft Office using a PowerShell script if you have an Office 365 or Microsoft 365 subscription. You must have an internet connection and a valid account associated with your license. This method works on Windows 10 and Windows 11 desktops, and it is the standard way administrators automate Office installations and activations.
What You'll Need
- A computer running Windows 10 or Windows 11 with administrator privileges.
- A Microsoft account with an active subscription to Office 365, Microsoft 365, or a retail license.
- Internet connectivity to download the Office setup components and communicate with Microsoft activation servers.
- Access to the Windows Start menu or Taskbar search to launch PowerShell.
Step-by-Step
- Open PowerShell as Administrator. To do this, click the Start button, type "PowerShell", right-click on "Windows PowerShell" in the search results, and select "Run as administrator". If a User Account Control (UAC) prompt appears, click "Yes" to allow the application to make changes to your device.
- Identify your Office installation.
In the PowerShell window, type the following command and press Enter:
Get-ItemProperty HKLM:\Software\Microsoft\Office\ClickToRun\CurrentVersion\ClickToRun | Select-Object ProductVersion
This command checks the registry for the installed version of Office. If Office is installed via Click-to-Run (the default modern installer), you will see the version number. If you are using a traditional MSI installer, the path may differ slightly, and you may need to use the Office Deployment Tool instead of this script. - Run the activation command.
Type the following command into the PowerShell window and press Enter:
C:\Program Files\Microsoft Office\Office16\ospp.vbs /act
Note: The pathC:\Program Files\Microsoft Office\Office16\ospp.vbsassumes you installed the 64-bit version of Office to the default location. If you installed the 32-bit version, the path will beC:\Program Files (x86)\Microsoft Office\Office16\ospp.vbs. You can verify this by looking at the file path in your Start menu shortcuts. - Verify the activation status.
After the command runs, type the following command and press Enter to check if the process was successful:
C:\Program Files\Microsoft Office\Office16\ospp.vbs /dstatus
You will see a detailed list of all installed Office products. Look for a column labeled "Activation Status". If it says "Licensed", the activation was successful. If it says "OOB Grace" or "Notification", the account is not recognized, or you may be encountering a specific error. - Handle subscription-based activation. For Office 365 and Microsoft 365, the above command often activates the product based on your global account. If you are on a business plan (e.g., Microsoft 365 Business Premium), the script may need to connect to your organization's account. In some enterprise environments, this automated activation is managed by a Group Policy Object (GPO) or a Configuration Manager task sequence, and the user simply needs to sign in to the Office apps.
- Sign in to the Office apps (optional but recommended). Even if the ospp.vbs script reports success, opening an Office application like Word or Excel and clicking "Activate Product Key" or signing in with your account can ensure that all features, including cloud storage and personalization, are fully enabled.
Common Mistakes
- Incorrect file path.
The most common error is using the wrong path for the
ospp.vbsfile. If the path is incorrect, the command will fail with a "File not found" error. Always check whether you are using the "Program Files" or "Program Files (x86)" folder, as Office can be installed in either depending on the system architecture. - Running PowerShell without elevation. If you do not run PowerShell as an administrator, the activation script may not have the necessary permissions to communicate with the licensing servers or modify the Office registry keys. You will likely see an error message stating that the operation was not allowed.
- Using the wrong Office version.
The
ospp.vbsscript is designed for Office 2010, 2013, 2016, and 2019. If you are using Office 365 (which is subscription-based) installed via Click-to-Run, the activation is handled differently. While the command often works for these versions, the most reliable method for Office 365 is to sign in directly within the Office apps. - Firewall or antivirus blocking. Some corporate firewalls or third-party antivirus software can block the script from connecting to Microsoft's activation servers. If the script runs but the status remains unlicensed, check your network settings and firewall exceptions to ensure PowerShell and the Office application have permission to access the internet.
Tips
- Use the
/prnflag for troubleshooting. If you are unsure why activation is failing, add the/prnflag to your command. This prints a detailed log of the activation process to the screen. This can help you identify if the error is related to a missing product key, a network timeout, or a corrupted Office installation. - Save the script for future use.
You can save the activation command to a text file with a
.ps1extension (e.g.,ActivateOffice.ps1). This makes it easier to run the command again later without having to type it out or find the file path every time. - Check the Office Setup Log.
For more complex issues, you can check the Office Setup log file located at
%temp%setup.log. This file contains detailed information about the installation process and can reveal if there were any errors during the setup phase that could affect activation. - Clear Office caches.
If you have recently changed your account or are having trouble syncing your settings, clearing the Office caches can sometimes resolve activation issues. You can do this by closing all Office applications and deleting the contents of the
%localappdata%MicrosoftOffice16\OfficeFileCachefolder.
Troubleshooting
- Error: 0xC004C003 (Subscription License Not Found). This error typically indicates that your account is not associated with the license or that the subscription has expired. Go to account.microsoft.com and sign in with your work or school account to verify your subscription status and ensure it is active.
- Error: 0xC004F074 (Software Protection Service Not Running). This error means that the Windows Software Protection service is not running. To fix this, open the "Services" app (type "services.msc" in the Start menu), locate the "Software Protection" service, and set its Startup type to "Automatic". Then, right-click the service and select "Start".
- Script runs but Office apps say not licensed.
This is often a synchronization issue. Close all Office applications completely. Open the Command Prompt and type
winword /safeto launch Word in Safe Mode. If it activates in Safe Mode, a third-party add-in or normal startup file is likely causing the conflict. Restart your computer to clear the memory and try again. - Product key is not recognized. If you are using a retail product key, ensure you are running the activation command on the same computer where the software is installed. Retail licenses are tied to the hardware. If you have recently upgraded your motherboard or performed a major system overhaul, you may need to deactivate the license on the old system before activating it again on the new one.
Frequently Asked Questions
Is this method safe for my computer?
Yes, the ospp.vbs script is an official Microsoft tool included with every installation of Office. It is harmless and does not contain any viruses or malware. However, as with any command-line tool, you should ensure you are running it from a trusted source and that you have read the commands before executing them.
What if I am using Office 2019 on Windows 7?
The ospp.vbs script works on older versions of Windows like Windows 7, but support for Windows 7 has ended. For optimal security and compatibility, it is recommended to upgrade to Windows 10 or 11. If you must use Windows 7, ensure you have installed all available security updates from Microsoft.
Can I activate Office without an internet connection?
Generally, no. The activation process requires a connection to Microsoft's activation servers to verify your license. However, for some volume licensing scenarios, you can activate offline using a KMS (Key Management Service) host. For individual users, an internet connection is required.
Why does the command line flicker?
The flicker you see when running the script is normal. It is caused by the script printing status messages to the console window in real-time. This is a feature of the command-line interface and does not indicate an error.
Do I need to restart my computer after running the script?
Not necessarily. The activation process is usually immediate. However, if you are also updating Office or changing system settings related to licensing, a restart can help ensure that all components are loaded correctly and the license is fully applied.