Installation on Windows
winget install -e --id PostgreSQL.PostgreSQL.17 downloads and runs the EnterpriseDB installer. The bare PostgreSQL.PostgreSQL package is stuck on version 14 in the winget-pkgs repository, so we explicitly target PostgreSQL.PostgreSQL.17 to get version 17. It installs the server, the pgAdmin graphical interface, the command-line utilities, creates the data cluster and registers a Windows service that starts automatically.
The interactive installation asks for a password for the postgres superuser: write it down, it is required for any later connection.
Windows service and service name
PostgreSQL runs as a Windows service named according to the major version, for example postgresql-x64-17. The net start / net stop and sc query commands above use this name: adjust it if you install another version — verify depending on the version.
Adding psql to the PATH
The executables reside in C:\Program Files\PostgreSQL\17\bin. If psql is not recognized in the terminal, add this folder to the Path environment variable, or launch "SQL Shell (psql)" from the Start menu.
First connection
Connect to the server as the postgres superuser. The easiest way is to launch "SQL Shell (psql)" from the Start menu and accept the defaults (server localhost, port 5432, database postgres, user postgres), then enter the password set during installation. From a terminal where psql is on the Path, the equivalent command is:
psql -U postgres