I am looking for clear step by step instructions to restore superuser role to postgres user that comes at install. I had to perform the below instructions (which didn't work thus far), because in pgAdmin I created a new Login Role user and assigned superuser privileges. Then I checked off superuser privileges from postgres, only to find out my new superuser was no superuser at all.
Below instructions are also here: Restoring the superuser account on the postgres server
1) Create a local user called 'postgres'
c:\windows\system32> net user username password /add
2) Assign write rights for this user on the data folder
right click on Postgresql 9.5 install folder at c:\Program files\Postgresql\9.5\
click properties
click security tab
click edit (computer as for administrative rights... ok)
select 'all users' and check box 'total control'
click apply and wait for computer to assign writing privileges
3) Stop the postgres service from services
open the services list on windows through task manager
right click on postgresql 9.5
stop the service
4) Open a command prompt as postgres user (e.g. runas /user:postgres cmd)
c:\windows\system32\runas /user:postgres cmd
enter postgres user password
wait for another cmd window open under postgres user
5) On postgres cmd window run postgres in single user mode
c:\windows\system32>cd c:\Program Files\PostgreSQL\9.5\bin
c:\Program Files\PostgreSQL\9.5\bin>postgres.exe --single -D c:\Program Files\PostgreSQL\9.5\data
At this point I get this error message:
postgres não pode acessar o arquivo de configuração do servidor "c:/Program/postgresql.conf": No such file or directory
Translating the part from Portugues to English you get:
postgres cannot access server's configuration file