Yes, you can install SQL Server entirely through the command line—no GUI required. This method is useful for developers, sysadmins, or automated deployments where you need to control every step precisely. The command-line installer supports fundamental editions (Express, Standard, Enterprise) and lets you skip or customize features, databases, and even optional components like management tools. You’ll need administrative access and the latest SQL Server installer files (`.msi` for Windows). No extra tools are needed beyond a PC with Windows (7/10/11) and elevated permissions.

What You'll Need

  • Windows PC (Windows 7/10/11) with administrative rights
  • SQL Server installer files (download from Microsoft)
  • Network access to download the installer (if using online installers)
  • A destination folder to extract the installer (e.g., `C:\SQLInstaller`)
  • A text editor (optional) to review the installer’s `--q` or `--flags` options

Step-by-Step

  1. Extract the installer files: Download the SQL Server installation media (e.g., `SQLServer2022Enterprise.msi`) and extract it to a known folder (e.g., `C:\SQLInstaller`). If using the online installer, ensure you have internet access. For automated scripts, use PowerShell or a batch file to run `Expand-Archive` or `7z x` instead.
  2. Launch the installer silently: Navigate to the extracted folder in Command Prompt as Administrator and run: sqlservr16setup.exe /q /I_ACCEPT_EULA=1 /I_ACCEPT_TOS=1 /FEATURES=SQL

    The key switches:

    • /q = Quiet install (no GUI prompts)
    • /I_ACCEPT_EULA=1 = Accepts the End User License Agreement (required)
    • /I_ACCEPT_TOS=1 = Accepts the terms of service
    • /FEATURES=SQL = Installs only the SQL Server core engine (omit to skip SQL; add ADWS for Windows Authentication, SSMS for Management Studio).
    Replace sqlservr16setup.exe with the exact filename for your SQL version (e.g., `sqlservr15setup.exe` for SQL Server 2019).
  3. Customize installation options (optional): Use flags like /SKIPCOMPONENTS to exclude optional features (e.g., SKIPCOMPONENTS=HighAvailability to skip failover clusters). For detailed control, append: /FEATURES=SQL /INSTALLDIR="C:\SQLSrv" /TARGETDIR="C:\SQLSrv" to set custom paths.

    Example for a lightweight install: sqlservr16setup.exe /q /I_ACCEPT_EULA=1 /I_ACCEPT_TOS=1 /FEATURES=SQL,SSMS /INSTALLDIR="C:\SQLSrv" /TARGETDIR="C:\SQLSrv"

  4. Verify installation: Open Command Prompt again and run: sqlservr16setup.exe /q /VERBOSE to see logs, or check for services in Services Manager (search for "SQL Server"). If using Express Edition, ensure mssqlserver starts automatically.

Common Mistakes

  • Missing EULA acceptance: The installer stops with "EULA violation" if you omit /I_ACCEPT_EULA=1. Double-check case sensitivity (EULA vs. eula).
  • Incorrect paths: If you set INSTALLDIR but didn’t define it earlier, the installer may fail. Always include both flags together.
  • Feature conflicts: Adding ADWS alongside SQL can trigger duplicate service creation errors. Specify only required features.
  • Admin rights failure: Run Command Prompt as Administrator to avoid "access denied" errors.

Tips

  • Use sqlservr16setup.exe /q /VERBOSE to debug silently—output shows where it hangs.
  • For automated scripts, pre-generate a silent install command with sqlservr16setup.exe /q /VERBOSE and copy the final flags.
  • Skip SSMS if you don’t need the GUI management tools.
  • Test connectivity after installation with net use \\\SQLSrv (replace with your PC name).

Troubleshooting

  1. Installer hangs or crashes: Try running sqlservr16setup.exe /q /VERBOSE in a new Command Prompt. If it shows "Waiting for dependencies," check for corrupted files. Use another mirror to download the installer or repair it: msiexec /f /q /norestart
  2. Services not starting: Verify the service name matches your FEATURES list. Right-click the service in Services Manager > Properties > Check "Automatic" startup type.

    If mssqlserver fails, start it manually via sqlservr16setup.exe /q /START or use sqlcmd -S localhost -Q "SELECT @@VERSION" to confirm SQL is running.

  3. Permission denied errors: Ensure your user is in the Local Administrators group. Reboot the PC if changes aren’t reflected.

    For network installations (e.g., shared folders), map the drive first (e.g., net use Z: \\server\share) then point the installer to Z:\installer.msi.

Frequently Asked Questions

How do I install SQL Server in minimal steps?

Install only the core engine with /FEATURES=SQL and silent flags: sqlservr16setup.exe /q /I_ACCEPT_EULA=1 /FEATURES=SQL

Can I install SQL Server 2022 silently via command line?

Yes. Replace sqlservr16setup.exe with the version-specific filename (e.g., `sqlservr20setup.exe`), and use the same /q flags.

What if the installer fails with "The operation completed successfully" but SQL isn’t installed?

The installer may exit quietly but not write to registry/Startup folder. Check services manually or verify SQL is running with sqlcmd -S localhost -Q "SELECT @@VERSION".

How do I uninstall SQL Server silently?

Use msiexec /x {GUID} /q, where {GUID} is the product ID found in regedit under HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall.

Do I need to accept the End User License Agreement (EULA)?

Yes. The /I_ACCEPT_EULA=1 flag is mandatory for any silent install.

Can I install SQL Server on a Windows Server Core edition?

Tested installations work on Server Core, but some optional components (e.g., SSMS) may require GUI. Always pre-check feature requirements.