In the Sharepoint Online Management Shell my goal is to call the cmdlet Invoke-SPOSiteDesign (doc) with one fixed Design (i.e. the -Identity parameter) onto all SPOSites on my tenant.

I can get all sites with Get-SPOSite (doc) but I don't know how to chain those two commands together. Pseudo-Code wise, I want:

for every $url retrieved by Get-SPOSite:
    Invoke-SPOSiteDesign -Identity 0000-0000-0000 -WebUrl $url

Can you help me on how to express that best?

有帮助吗?

解决方案

Use below code:

# Get all site collections
$siteCollections = Get-SPOSite

# loop through all site collections
foreach($siteCollection in $siteCollections) {
    Invoke-SPOSiteDesign -Identity 0000-0000-0000 -WebUrl $siteCollection.url
}
许可以下: CC-BY-SA归因
scroll top