{"id":1005,"date":"2014-10-07T06:59:13","date_gmt":"2014-10-07T06:59:13","guid":{"rendered":"https:\/\/poiseddevelopers.com\/reality-tech\/?p=1005"},"modified":"2024-04-26T12:33:35","modified_gmt":"2024-04-26T12:33:35","slug":"granting-myself-site-collection-admin-access","status":"publish","type":"post","link":"https:\/\/poiseddevelopers.com\/reality-tech\/granting-myself-site-collection-admin-access\/","title":{"rendered":"Granting myself site collection admin access"},"content":{"rendered":"<p>Sometimes one needs to grant themselves site collection admin access, here\u2019s two kinds of site collection admin status assignments:<\/p>\n<pre lang=\"php\">$meStr = \"domain\\administrator\";\r\n$w = get-spweb \"http :\/\/subdomain.domain.com\/sites\/Projects\"\r\n$me = $w.ensureuser($meStr)\r\n$me.issiteadmin\r\n$me.issiteadmin=$true\r\n$me.update()\r\n<\/pre>\n<p>Or set Primary or secondary:<\/p>\n<pre lang=\"php\">Get-SPSite -Limit All | ?{$_.url -notlike \"*\/Departments\/\"} | %{Set-SPSite $_ -OwnerAlias \"\" -SecondaryOwnerAlias \"\"}\r\n<\/pre>\n<p>Don\u2019t forget to pipe your SPContentDatabases and even all SPDatabases into an AddSPShellAdmin CmdLet to ensure DB access for yourself is granted.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes one needs to grant themselves site collection admin access, here\u2019s two kinds of site collection admin status assignments: $meStr = &#8220;domain\\administrator&#8221;; $w = get-spweb &#8220;http :\/\/subdomain.domain.com\/sites\/Projects&#8221; $me = $w.ensureuser($meStr) $me.issiteadmin $me.issiteadmin=$true $me.update() Or set Primary or secondary: Get-SPSite -Limit All | ?{$_.url -notlike &#8220;*\/Departments\/&#8221;} | %{Set-SPSite $_ -OwnerAlias &#8220;&#8221; -SecondaryOwnerAlias &#8220;&#8221;} Don\u2019t forget to [&hellip;]<\/p>\n","protected":false},"author":8,"featured_media":1012,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[26],"tags":[],"class_list":["post-1005","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"acf":[],"_links":{"self":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/comments?post=1005"}],"version-history":[{"count":6,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1005\/revisions"}],"predecessor-version":[{"id":1018,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1005\/revisions\/1018"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media\/1012"}],"wp:attachment":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media?parent=1005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/categories?post=1005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/tags?post=1005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}