Sometimes one needs to grant themselves site collection admin access, here’s two kinds of site collection admin status assignments:
$meStr = "domain\administrator";
$w = get-spweb "http ://subdomain.domain.com/sites/Projects"
$me = $w.ensureuser($meStr)
$me.issiteadmin
$me.issiteadmin=$true
$me.update()
Or set Primary or secondary:
Get-SPSite -Limit All | ?{$_.url -notlike "*/Departments/"} | %{Set-SPSite $_ -OwnerAlias "" -SecondaryOwnerAlias ""}
Don’t forget to pipe your SPContentDatabases and even all SPDatabases into an AddSPShellAdmin CmdLet to ensure DB access for yourself is granted.
Want to talk?
Drop us a line. We are here to answer your questions 24*7.