I am using SP2013 single server dev environment. I use following scripts for creating web application and site collection. but when I browse to it, it says this site has not been shared with you. I am Administrator and logged on as Administrator and cleaned all cache services.
$appPoolAccount = "dev\sp_service"
New-SPWebApplication -ApplicationPool $appPool -ApplicationPoolAccount $appPoolAccount -Name $name -DatabaseName $dataBaseName -Url $url -Port $port -HostHeader $hostHeader -AuthenticationMethod "NTLM"
$domainAnduser = "dev\Administrator"
New-SPSite -Url $url -OwnerAlias $domainAnduser -Name $name -Template $template -Language 1033
It works if I do all above via CA.