Skip to main content

Connect sharepoint management shell with site collection admin in 1 site only and remove content ty [Resolved]

how connect in sharepoint management shell of 1 site only without an access in, I have an site collection admin in 1 site of this sharepoint and i need to connect it in sharepoint management shell to remove content type under in _Hidden Group thanks.

Question Credit: Randy Prado
Question Reference
Asked July 11, 2019
Posted Under: Sharepoint
1 Answers

Yes, you could do that.

Demo PowerShell code for your reference:


$userCredential = Get-Credential -UserName $adminUPN -Message "xxx"

Connect-PnPOnline -Url -Credentials $userCredential

#Get content type from _Hidden group
Get-PnPContentType|? { $_.Group -eq '_Hidden' }
#remove "ContentType1" content type
Remove-PnPContentType -Identity "ContentType1" -Force

Get-PnPContentType|? { $_.Group -eq '_Hidden' }

Note: $adminUPN could be just the site collection administrator of site collection, in my test, it could work well.

Result: enter image description here enter image description here

credit: Kally_MSFT
Answered July 11, 2019
Your Answer