When logging in, powershell just hung because when logging in at the command line, you are then prompted to enter the user's password.
The way around this is to set a temporary environment variable for the username you are logging in as in the powershell script. This will only exist for the duration of the running script.
$Env:PGPASSWORD = "YourPasswordHere"
$sqlScript = "C:\script_location\script.sql"
$executeCommand = 'psql.exe -d DBNAME -U USERNAME -f $sqlScript'
iex "& $executeCommand"