Best way to chain together two SPO cmdlets
سؤال
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
}
لا تنتمي إلى sharepoint.stackexchange