Thursday, 28 February 2013

Windows PowerShell for SharePoint Online Reference - Part 1

You can now use SharePoint Online Management Shell to performs administration tasks on SharePoint Online. In this article I have put together a reference to all the commands available to date for SharePoint Online with examples.

You can also use the "Windows PowerShell for SharePoint Command Builder" tool to build commands using a drag and drop interface which allows you to select and enter command parameters in a visual way. Refer to this post for more information about this tool.

Service connection and disconnection


Connect-SPOService 
This command is used to establish a connection to SharePoint Online Administration Center.
Examples:
Connect-SPOService -Url https://adoptcloud-admin.sharepoint.com -credential amin.tavakoli@adoupcloud.com


Disconnect-SPOService 
Use this to disconnect from SharePoint Online.
Examples:
Disconnect-SPOService


User management


Add-SPOUser
This coman is used to add an existing Office 365 user or an Office 365 security group to a SharePoint group.
Examples:
Add-SPOUser -Site https://adoptcloud.sharepoint.com/sites/marketing -LoginName amin.tavakoli@adoptcloud.com -Group "Marketing Owners"


Get-SPOUser 
This command is used to return the SharePoint Online user or security group accounts that match a given search criteria.
Examples:
Get-SPOUser -Site https://adoptcloud.sharepoint.com/sites/marketing -Group "Team Site Members"
or
Get-SPOUser -Site https://adoptcloud.sharepoint.com/sites/marketing -LoginName amin.tavakoli@adoptcloud.com

Remove-SPOUser 
Use this command to remove a user or a security group from a site collection or a group.
Examples:
Remove-SPOUser -Site https://adoptcloud.sharepoint.com/sites/marketing -LoginName amin.tavakoli@adoupcloud.com -Group "Marketing Owners"

Set-SPOUser 
This can be used to configure properties of an existing user
Examples:
Set-SPOUser -Site https://adoptcloud.sharepoint.com/sites/marketing -LoginName amin.tavakoli@adoupcloud.com -IsSiteCollectionAdmin $true 

User group management

Get-SPOSiteGroup
Use this command to get a list of all the groups on the specified site collection.
Examples:
Get-SPOSiteGroup -Site http://adoptcloud.sharepoint.com/sites/marketing


New-SPOSiteGroup
This command can be used to create a new group in a SharePoint Online site collection.
Examples:
New-SPOSiteGroup -Site https://adoptcloud.sharepoint.com/sites/marketing -Group "Senior Marketing Staff" -PermissionLevels "Design"


Remove-SPOSiteGroup 
Use this to remove a SharePoint Online group from a site collection.
Examples:
Remove-SPOSiteGroup -Site https://adoptcloud.sharepoint.com/sites/marketing -Identity "MarketingManagers"


Set-SPOSiteGroup
This command updates the SharePoint Online owner and permission levels on a group inside a site collection.
Examples:
Set-SPOSiteGroup -Site https://adoptcloud.sharepoint.com -Identity "CoolGroup" -Owner amin.tavakoli@adoupcloud.com

Site collection management

Get-SPODeletedSite 
Use this to get a list of deleted SharePoint sites in the Recycle Bin.
Examples:
Get-SPODeletedSite -Identity http://adoptcloud.sharepoint.com/sites/UncoolSite

Get-SPOSite
This command returns one or more site collections
Get-SPOSite -Identity https://adoptcloud.sharepoint.com


New-SPOSite
Use this to create a site collection.
Examples:
New-SPOSite -Url http://adoptcloud.sharepoint.com/sites/CoolSite -Owner amin.tavakoli@adoupcloud.com -StorageQuota 1500 -CompatibilityLevel 15 -LocaleID 1033 -ResourceQuota 300 -Template "mytemplatename" -TimeZoneId 13 -Title "This is my new so cool site"


Remove-SPODeletedSite
Use this command to get rid of the sites in the Recycle Bin.
Examples:
Remove-SPODeletedSite -Identity https://adoptcloud.sharepoint.com/sites/IHateThisSite

Remove-SPOSite
Use this to delete a site. After deletion site will remain in Recycle Bin.
Examples:
Remove-SPOSite -Identity https://adoptcloud.sharepoint.com/sites/uncoolsite -NoWait

Repair-SPOSite
This command can be used to checks and repair a site collection and its contents.
Examples:
Repair-SPOSite https://adoptcloud.sharepoint.com/sites/damagedcoolsite

Restore-SPODeletedSite 
Use this command to restore a deleted site collection from the Recycle Bin.
Examples:
Restore-SPODeletedSite -Identity https://adoptcloud.sharepoint.com/sites/myrecycledsite

Set-SPOSite
Use this to set or update one or more properties for a site collection.
Examples:
Set-SPOSite -Identity https://adoptcloud.sharepoint.com -StorageQuota 3000 -StorageQuotaWarningLevel 2000


Test-SPOSite 
Use this command to test a  site collection.
Examples:
Test-SPOSite https://adoptcloud.sharepoint.com/sites/coolsite

1 comment:

  1. Any way to pass the password?
    Anything to import into or update Custom Lists?

    ReplyDelete