After 2007 ContentDB Upgrade to 2010: Access Denied When Viewing Sites
If you see Access Denied errors after Upgrading your ContentDBs from MOSS 2007 to SharePoint 2010 the issue might be related to the superuser is not configured for your service account. The Service account needs full control to your Web Application or you will get some Access Denied issues post-Upgrade,
Here is the script to enable it below:
#Setup Superuser account
$env:farmname = “yourfarmname”
$env:farmurl = “yourfarmurl”
$env:serviceacct =”DOMAIN\user”
Write-Host -ForegroundColor Yellow "Permissions: Adding Farm Account to superuser for $env:farmname."
Set-Alias stsadm ((Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0').Location + "Bin\stsadm.exe")
$wa=Get-SPWebApplication $env:farmurl
$wapol=$wa.Policies
#Write-Host "Adding User to Web App : $wapol.Add($env:serviceacct,$env:serviceacct)"
$wapkmcrawl=$wapol.Add($env:serviceacct,$env:serviceacct)
$wapkmcrawl.PolicyRoleBindings.Add($wa.PolicyRoles["Full Control"])
$wa.update()
stsadm -o setproperty -propertyname portalsuperuseraccount -propertyvalue $env:serviceacct -url $env:farmurl
Write-Host -ForegroundColor Yellow "Permissions: Adding Farm Account to superuser for $env:farmname. : COMPLETED"