Sunday, 31 January 2016

OneLiners for PowerShell with SharePoint Online

At last, I got a SharePoint Online setup for free for now.
Then, I downloaded the SharePoint Online Management Shell from https://www.microsoft.com/en-us/download/details.aspx?id=35588 by choosing the 64 bit version. You may check the version of your Windows by Right Clicking the leftmost bottom corner and choosing System ->System Type.
Below is the first command to connect to SharePoint Online:
Connect-SPOService -Url "https://<yourname>-admin.sharepoint.com" -Credential <alias>@<yourname>.onmicrosoft.com
Examples:
Connect-SPOService -Url "https://spthangu-admin.sharepoint.com" -Credential explore@spthangu.onmicrosoft.com

Ensure you Run the Powershell as Administrator(Shift+Right Click->Run ISE as Administrator)
and use the admin url of the SharePoint site and not the SharePoint site.

The above command to connect must be run before you execute any of the below One Liners:
#View SharePoint Online organization properties
Get-SPOTenant
#View App Errors(Get the number after "@" sysmbol of the App from Site Setting->App #Permissions
Get-SPOAppErrors -ProductId 067e1a0e-58d2-4366-b56f-5bf9b563b284
#View App Info
Get-SPOAppInfo -Name "Microsoft.SharePoint"
#Get Deleted Site
Get-SPODeletedSite
#Get External User
Get-SPOExternalUser
#Get Migration Job Status and Progress
Get-SPOMigrationJobProgress
Get-SPOMigrationJobStatus -TargetWebUrl https://spthangu.sharepoint.com
#View all details of a SharePoint site
Get-SPOSite -Identity "https://spthangu.sharepoint.com"|Format-List
#Display the count of sites under a site collection
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").WebsCount
#Get the Title of Site Collection
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").Title
#View the Sharing capability
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").SharingCapability
#View the last content modified date
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").LastContentModifiedDate
#View LocaID or language settings 1033 English
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").LocaleId
#View LockState(UnLock)
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").LockState
#View Site Admninistrator/Owner
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").Owner
#View if PWA is enabled
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").PWAEnabled
#Check Status of Site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").Status
#View Site Template
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").Template
#View URL of a site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").Url
#View Resource Quota
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").ResourceQuota
#View Resource Warning Level of a Site[255]
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").ResourceQuotaWarningLevel
#View average Resource Usage of a site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").ResourceUsageAverage
#View Current Resource Usage of a site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").ResourceUsageCurrent
#View Sandbox capacity of a site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").SandboxedCodeActivationCapability
#View Storage Quota of a Site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").StorageQuota
#View Storage Quota of a Site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").StorageQuotaType
#View Storage Quota Warning level of a site
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").StorageQuotaWarningLevel
#View Current Storage Usage
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").StorageUsageCurrent

#View count of Webs
(Get-SPOSite -Identity "https://spthangu.sharepoint.com").WebsCount
#View Site Groups
Get-SPOSiteGroup -Site "https://spthangu.sharepoint.com"
#View only NAmes
Get-SPOSiteGroup -Site https://spthangu.sharepoint.com | select LoginName,Roles
 
#View Users for Group
Get-SPOSiteGroup -Site https://spthangu.sharepoint.com | select LoginName,Users | format-table -Wrap

#Tenant Properties
 (Get-SPOTenant).StorageQuota
(Get-SPOTenant).StorageQuotaAllocated
(Get-SPOTenant).ResourceQuota
(Get-SPOTenant).ResourceQuotaAllocated
(Get-SPOTenant).OneDriveStorageQuota
(Get-SPOTenant).CompatibilityRange
(Get-SPOTenant).ExternalServicesEnabled
(Get-SPOTenant).NoAccessRedirectUrl
(Get-SPOTenant).SharingCapabilit
(Get-SPOTenant).DisplayStartASiteOption
"Tenant Properties"
"StartASiteFormUrl for Tenant"
(Get-SPOTenant).StartASiteFormUrl
" ShowEveryoneClaim for Tenant?"
(Get-SPOTenant).ShowEveryoneClaim 
"ShowAllUsersClaim for Tenant?"
(Get-SPOTenant).ShowAllUsersClaim
" OfficeClientADALDisabled Status for Tenant?"
(Get-SPOTenant).OfficeClientADALDisabled
"LegacyAuthProtocolsEnabled for Tenant?"
(Get-SPOTenant).LegacyAuthProtocolsEnabled
"ShowEveryoneExceptExternalUsersClaim for Tenant?"
(Get-SPOTenant).ShowEveryoneExceptExternalUsersClaim
"SearchResolveExactEmailOrUPN for Tenant?"
(Get-SPOTenant).SearchResolveExactEmailOrUPN   
"    RequireAcceptingAccountMatchInvitedAccount for Tenant?"
(Get-SPOTenant).RequireAcceptingAccountMatchInvitedAccount
"ProvisionSharedWithEveryoneFolder for Tenant?"
(Get-SPOTenant).ProvisionSharedWithEveryoneFolder 
"ProvisionSharedWithEveryoneFolder for Tenant?"     
(Get-SPOTenant).SignInAccelerationDomain
"UsePersistentCookiesForExplorerView    for Tenant?"            
(Get-SPOTenant).UsePersistentCookiesForExplorerView 
"BccExternalSharingInvitations    for Tenant?"
(Get-SPOTenant).BccExternalSharingInvitations  
"    BccExternalSharingInvitationsList      for Tenant?"
(Get-SPOTenant).BccExternalSharingInvitationsList
"  UserVoiceForFeedbackEnabled      for Tenant?"
(Get-SPOTenant).UserVoiceForFeedbackEnabled
"            RequireAnonymousLinksExpireInDays    for Tenant?"
(Get-SPOTenant).RequireAnonymousLinksExpireInDays   for Tenant?"
"       SharingAllowedDomainList  for Tenant?"
(Get-SPOTenant).SharingAllowedDomainList 
"SharingBlockedDomainList      for Tenant? "         
(Get-SPOTenant).SharingBlockedDomainList 
"    SharingDomainRestrictionMode     for Tenant?"       
(Get-SPOTenant).SharingDomainRestrictionMode             
"OneDriveForGuestsEnabled for Tenant?"
(Get-SPOTenant).OneDriveForGuestsEnabled                 
Get-SPOTenantLogEntry
#Last Login Time
Get-SPOTenantLogLastAvailableTimeInUtc
Get-SPOTenantSyncClientRestriction

Get-SPOWebTemplate
Get-SPOWebTemplate|select Title

#In PRogres#
$spoSite = Get-SPOSite -Identity "https://spthangu.sharepoint.com"
#View all Team Sites
$spoSite | ?{$_.Template -like "*STS#0" -or $_.Template -like "*EHS#1*"}
#View all Blogs
$spoSite | ?{$_.Template -like "*BLOG#0" }
#Document Center
$spoSite | ?{$_.Template -like "*BDR#0" }
#Developer Site
$spoSite | ?{$_.Template -like "*DEV#0" }
#Records Center
$spoSite | ?{$_.Template -like "*OFFILE#1" }
#BI
$spoSite | ?{$_.Template -like "*BICenterSite#0" }
#Search
$spoSite | ?{$_.Template -like "*SRCHCEN#0" }
#Publishing
$spoSite | ?{$_.Template -like "*BLANKINTERNETCONTAINER#0"}
#Wiki
$spoSite | ?{$_.Template -like "*ENTERWIKI#0"}
#Project Site
$spoSite | ?{$_.Template -like "*PROJECTSITE#0"}

#View all Product Catalog
$spoSite | ?{$_.Template -like "*PRODUCTCATALOG#0"}
#View all Community Site
$spoSite | ?{$_.Template -like "*COMMUNITY#0" }
#Community POrtal
$spoSite | ?{$_.Template -like "*COMMUNITYPORTAL#0" }
#Search Site
$spoSite | ?{$_.Template -like "*SRCHCENTERLITE#0 " }
#Visio Process Repository
$spoSite | ?{$_.Template -like "*visprus#0" }

#Get commands Over

#Below are New Type Commands
#Create a new Site Collection
$Url = "https://spthangu.sharepoint.com/sites/Prod"
$Title = "Production Site"
$template = "STS#0"
New-SPOSite -Url $Url -Owner $User -Title $Title -Template $template -StorageQuota 10000
#View newly created site
$sites=Get-SPOSite
$sites

Below are the commonly used command lets from Microsoft for SharePoint Online:
User management cmdlets
CmdletDescription
Add-SPOUser Adds an existing Office 365 user or an Office 365 security group to a SharePoint group.
Get-SPOUser Returns the SharePoint Online user or security group accounts that match a given search criteria.
Remove-SPOUser Removes a user or a security group from a site collection or a group.
Set-SPOUser Configures properties on an existing user.
Get-SPOExternalUser Returns external users that are located in the tenant's folder based on specified criteria.
Remove-SPOExternalUser Permanently removes a collection of external users from the tenant’s folder.
Top of Page

User group management cmdlets

CmdletDescription
Get-SPOSiteGroup Gets all the groups on the specified site collection.
New-SPOSiteGroup Creates a new group in a SharePoint Online site collection.
Remove-SPOSiteGroup Removes a SharePoint Online group from a site collection.
Set-SPOSiteGroup Updates the SharePoint Online owner and permission levels on a group inside a site collection.
Top of Page

Upgrade cmdlets

CmdletDescription
Upgrade-SPOSite Starts the upgrade process on a site collection.
Request-SPOUpgradeEvaluationSite Requests creation of a copy of an existing site collection for the purposes of validating the effects of upgrade without affecting the original site.
Top of Page

Site collection management cmdlets

CmdletDescription
Get-SPODeletedSite Returns all deleted site collections from the Recycle Bin
Get-SPOSite Returns one or more site collections.
New-SPOSite Creates a new SharePoint Online site collection for the current company.
Remove-SPODeletedSite Removes a SharePoint Online deleted site collection from the Recycle Bin.
Remove-SPOSite Sends a SharePoint Online site collection to the SharePoint Online Recycle Bin.
Repair-SPOSite Checks and repairs the site collection and its contents.
Restore-SPODeletedSite Restores a SharePoint Online deleted site collection from the Recycle Bin.
Set-SPOSite Sets or updates one or more properties' values for a site collection.
Test-SPOSite Tests a SharePoint Online site collection.
Top of Page

Service connection and disconnection cmdlets

CmdletDescription
Connect-SPOService Connects a SharePoint Online global administrator to a SharePoint Online connection; that is, connects the administrator to the SharePoint Online Administration Center.

This cmdlet must be run before any other SharePoint Online cmdlets can run.
Disconnect-SPOService Disconnects from a SharePoint Online service.

Organization-level monitoring and management cmdlets

CmdletDescription
Get-SPOAppErrors Returns application errors.
Get-SPOAppInfo Returns all installed applications.
Get-SPOTenant Returns SharePoint Online organization properties.
Get-SPOTenantLogEntry Retrieves SharePoint Online company logs.
Get-SPOTenantLogLastAvailableTimeInUtc Returns the time when the SharePoint Online organization logs are collected.
Get-SPOWebTemplate Displays all site templates that match the given identity.
Set-SPOTenant Sets properties on the SharePoint Online organization.


References
https://support.office.com/en-us/article/Introduction-to-the-SharePoint-Online-Management-Shell-c16941c3-19b4-4710-8056-34c034493429#__upgrade_cmdlets

No comments:

Post a Comment