Skip to content

Get-MgSite properties not returning when -all is used in conjunction with -ExpandProperty. #3222

@storablelight

Description

@storablelight

Describe the bug

When I run: Get-MgSite -All -ExpandProperty Drive

All some properties are empty when using -All or -Top 10

$Sites[0].Drive

Name Id DriveType CreatedDateTime


But when running Get-MgSite -siteId <example site id> -ExpandProperty Drive it works as expected:

$site.Drive

Name Id DriveType CreatedDateTime


OneDrive b!Pk2E5-ljkk<>DvB business 01/03/2025 02:30:31

Same behavior for other expanded properties like Analytics and CreatedByUser (not tested all)

Expected behavior

Expected same property output from calling by siteId as calling All.

How to reproduce

Execute $Sites = Get-MgSite -All -ExpandProperty Drive
Note none of the Drive attributes are populated.

SDK Version

2.26.1

Latest version known to work for scenario above?

No response

Known Workarounds

Can run a foreach-object loop to run the command individually but it takes a lot longer.

Debug output

Click to expand log ```
</details>


### Configuration

Windows 11 x64

Name                           Value
----                           -----
PSVersion                      5.1.26100.2161
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.26100.2161
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

### Other information

_No response_

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugA broken experience

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions