Forum Discussion
Powershell Script to list ALL videos in your 365 Stream environment
- Oct 22, 2022
Anyone looking at this script should also look at the PowerShell script that was released by Microsoft as part of the Stream (Classic) migration tools. The PowerShell script released by Microsoft can be downloaded directly from Stream (Classic) admin page and also has a PowerBI Desktop template that can be used to analyze the output CSVs.
See this part of the migration help articles for more info:
https://learn.microsoft.com/stream/streamnew/migration-details#stream-classic-video-report
First of all HUGE THANK YOU for this script Dorje-McKinnon
Running your code that generates the URLs, I found we have 10,400+ videos in Stream. I knew we were over 1.3 TB of space, but I couldn't find a way in the MS Stream Admin pages to understand the size and scope of the problem. We are a global company and with everyone in lock-down for a year, this got out of hand in a hurry.
I also wanted to share some of the additional '$datum' I've added and found useful
$datum | Add-Member -MemberType NoteProperty -Name VideoDuration -Value $myVideo.media.duration
$datum | Add-Member -MemberType NoteProperty -Name VideoHeight -Value $myVideo.media.height
$datum | Add-Member -MemberType NoteProperty -Name VideoWidth -Value $myVideo.media.width
$datum | Add-Member -MemberType NoteProperty -Name VideoIsAudioOnly -Value $myVideo.media.isAudioOnly
$datum | Add-Member -MemberType NoteProperty -Name VideoContentType -Value $myVideo.contentType
these return values like the following
VideoDuration VideoHeight VideoWidth VideoIsAudioOnly
PT28M10.25S | 360 | 640 | FALSE |
PT1H55M13.6S | 360 | 640 | FALSE |
PT56M19.6S | 360 | 640 | FALSE |
PT28M14.144S | 1080 | 1920 | FALSE |
PT1H10M34.56S | 1080 | 1920 | FALSE |
Video Duration is going to be a bit tricky to parse out in Excel. And the VideoIsAudioOnly is returning FALSE on all videos so far, so I will leave that one out.
But again GREAT code here Dorje
Thank you,
Jonathan Ogden
I'm glad this has helped you and your users out.
Thanks so much for the extra properties of the videos, I've just this week been asked if I can get out the length of the videos, so great timing!
Dorje
- abraraliFeb 23, 2021Copper Contributor
Dorje-McKinnonThanks for your efforts to build the script and make our lives easier. However, when I rum the URL (After changing the values) I'm getting a blank excel file.
Can someone help me out here?
- Dorje-McKinnonAug 05, 2021Iron Contributor
Hi abrarali , try running the new code.
It will auto open the JSON browser tabs, which you need to then manually save (ctrl + s) as JSON files into the folder you define in the script.
Once those files exist, then your CSV file will contain something.
- Jonathan_OgdenFeb 23, 2021Copper Contributor
Here is the URL I use for Western US. different regions have different datacenters, so you need to update the first part of the URL, the uswe-1
https://uswe-1.api.microsoftstream.com/api/videos?NoSignUpCheck=1&$top=100&$orderby=publishedDate%20desc&$expand=creator,events&$filter=published%20and%20(state%20eq%20%27Completed%27%20or%20contentSource%20eq%20%27livestream%27)&adminmode=true&api-version=1.4-private&$skip=0
Sorry for the mess, I just wanted to remove any ID's and user info.
Here is the output from the browser.
I had to copy and paste this into a txt file, then change the .txt to .json
- Dorje-McKinnonMar 06, 2021Iron Contributorthanks for answering Jonathan_Ogden