Manage Sharepoint Online using Powershell
If you familiar enough with the sharepoint online feature and administration, we can continue to explore how to manage our sharepoint online using shell.
- SharePoint Online Site (you can get one free with O365 developer trial)
- SPO Management Shell
Open the Shell
After you have done the installation, you can open the
SPO Management Shell by type to
sharepoint to on your start-apps. Then right click and run as administrator.
Because our company is behind proxy, we should execute this command to use dafault proxy:
$cred = [System.Net.CredentialCache]::DefaultCredentials [System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred
Connect to SharePoint Online
After that, we can try to connect to our sharepoint, using Connect-SPOService:
$adminUPN="<the full email address of a SharePoint Online global administrator account, example: email@example.com>" $orgName="<name of your Office 365 organization, example: contosotoycompany>" $userCredential = Get-Credential -UserName $adminUPN -Message "Type the password." Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
below is example of mine:
$adminUPN="firstname.lastname@example.org" $orgName="spmitrais" $userCredential = Get-Credential -UserName $adminUPN -Message "why-you-soRUDe123" Connect-SPOService -Url https://$orgName-admin.sharepoint.com -Credential $userCredential
After you successful connect to your site, now you should try a command to manage your SharePoint. Below is sample command to create subsite on your site.
New-SPOSite -Url https://spmitrais.sharepoint.com/sites/hellow -Owner email@example.com oft.com -StorageQuota 1000 -Title "Hello it is Me!"
You should go to microsoft site for complete references.