Copilot for Microsoft 365 Tech Accelerator
Feb 28 2024 07:00 AM - Feb 29 2024 10:30 AM (PST)
Microsoft Tech Community
SOLVED

Get-csOnlineLisSubnet | Export-csv not working

Iron Contributor

I am trying to retrieve all subnet information using the cmdlet. Get-csOnlineLisSubnet. this will give me a list of subnets. But when I tried to export it to csv using the folowing cmdlet, no subnets information are exported successfully 

 

Get-csOnlineLisSubnet | Export-csv c:\temp\subnets.csv

 

Thanks in advance

7 Replies
Hello,
Do you get something in the .csv file?
Andres, here is the info from output csv file

#TYPE Deserialized.System.Collections.Generic.List`1[[System.Management.Automation.PSObject System.Management.Automation Version=3.0.0.0 Culture=neutral PublicKeyToken=31bf3856ad364e35]]
PSComputerName RunspaceId PSShowComputerName Capacity Count IsFixedSize IsReadOnly IsSynchronized SyncRoot
api.interfaces.records.teams.microsoft.com 7de3aa65-628c-4971-90ca-73933355b8d1 FALSE 128 123 FALSE FALSE FALSE System.Object




I saw a customized code for retrieving subnet information, but don't know how to use this piece code
https://www.powershellgallery.com/packages/MicrosoftTeams/2.3.0/Content/net472%5Cexports%5CGet-CsOnl...
I tried the exact same command as you and, this is what I get:

"Description","LocationId","Subnet"
"","12afd15f-81bb-4307-8cc0-7e3143066d8c","10.10.10.128"

What is the version of the Teams module you are using?

Andres, Thnaks a lot for your help! I use the 2.0 version of Microsoft.Teams. Finally I use the following code to get the subnets information I wanted. I still don't know why the export-csv cmdlet does not work.

$subnets = Get-csOnlineLisSubnet
foreach ($subnet in $subnets)
{
Write-Host("LocationID: $($subnet.LocationID) Subnet: $($subnet.Subnet) Description: $($subnet.Description)")
}
best response confirmed by px091 (Iron Contributor)
Solution
Maybe you want to update to 3.0.0, 2.0 is pretty old

you can keep track of versions here https://msshells.net
I update my Teams module to v3.0. The following cmdlet works right away. Thanks Andres for your help!

Get-csOnlineLisSubnet | Export-csv c:\temp\subnets.csv
1 best response

Accepted Solutions
best response confirmed by px091 (Iron Contributor)
Solution
Maybe you want to update to 3.0.0, 2.0 is pretty old

you can keep track of versions here https://msshells.net

View solution in original post