Forum Discussion
reshmeeauckloo
May 12, 2024Brass Contributor
Issue with get-sposite SPO PowerShell
Issue with SPO PowerShell get-sposite for all sites not returning the correct values for different properties SharingDomainRestrictionMode , LimitedAccessFileType, DefaultSharingLinkType, DefaultLink...
- May 13, 2024Unfortunately the MS case got closed as SPO PowerShell scripting was not supported by the support team.
The only way to get the correct properties is to iterate through each site
```
$sites = Get-SPOSite -Limit All | Select-Object -Property Url
$siteArray = @();
foreach($site in $sites)
{
$siteProp = Get-SPOSite -Identity $site.Url
$siteArray+=$siteProp
}
$siteArray | Select-Object -Property *
VasilMichev
May 12, 2024MVP
Just to clarify, you mean that the value for some properties is empty/wrong when using the generic "LIST" method, but correct when using the individual "GET" one? If that is the case, then this is by design - some properties are considered "expensive" and only populated when fetching individual objects and not the whole collection. Same principle is used across other workloads too, not just SPO.
- reshmeeaucklooMay 13, 2024Brass ContributorThanks Vasil. I have raised a Microsoft case to look into it and will wait to see what is their response if the ticket is passed to the correct team to look into.
- reshmeeaucklooMay 13, 2024Brass ContributorUnfortunately the MS case got closed as SPO PowerShell scripting was not supported by the support team.
The only way to get the correct properties is to iterate through each site
```
$sites = Get-SPOSite -Limit All | Select-Object -Property Url
$siteArray = @();
foreach($site in $sites)
{
$siteProp = Get-SPOSite -Identity $site.Url
$siteArray+=$siteProp
}
$siteArray | Select-Object -Property *