You said that you are working with a publishing enabled site. As far as I know, the code you are using can't work on Publishing sites, you should use the
.DefaultPage property provided by the
PublishingSite class instead.
Try something like this:
// note: pageFile is the acuall SPFile for the page, not just the url.
Notice that you have to get a
PublishingWeb first - think of it like a sort of wrapper that extends the normal
SPWeb object and provides new functionalities specific for publishing enabled web sites.
$web.RootFolder.WelcomePage = $page. Assuming
$pageis the url of the page (ie.
default.aspx). Not sure if it will pick up pages from
Pageslibrary, but this definitely works for