Jul 19 2017 03:53 AM - edited Jul 19 2017 03:54 AM
Hi guys,
Can someone tell me what is wrong with attached script. When I change my own tenant settings and run this, I got below error. I have gone it trought a dosens of times and I just can't see what I'm missing.
I am running this script on SPO shell and trying to list all the Office 365 video portals that I have in the tenant
PS C:\temp> .\ExportVideoChannelsInfoToCSV.ps1
At C:\temp\ExportVideoChannelsInfoToCSV.ps1:54 char:92
+ ... Member –MemberType NoteProperty –Name $group.Title –Value $true
+ ~~~~~~~~~~~~
The string is missing the terminator: ".
At C:\temp\ExportVideoChannelsInfoToCSV.ps1:48 char:31
+ $group.Users | ForEach-Object {
+ ~
Missing closing '}' in statement block or type definition.
At C:\temp\ExportVideoChannelsInfoToCSV.ps1:45 char:55
+ ForEach($group in @($contributors,$viewers,$creators)){
+ ~
Missing closing '}' in statement block or type definition.
At C:\temp\ExportVideoChannelsInfoToCSV.ps1:31 char:36
+ $results.d.results | ForEach-Object{
+ ~
Missing closing '}' in statement block or type definition.
+ CategoryInfo : ParserError: (:) [], ParseException
+ FullyQualifiedErrorId : TerminatorExpectedAtEndOfString
Jul 19 2017 05:42 AM
Hi,
Here i attached modified script, it will solve your issue.
Jul 19 2017 07:17 AM
Hi Anna-Maria,
You have a problem with encoding where a few dashes (-) are replaced with the text –. This usually happens when copying and pasting text between different programs.
Try using the following code to "fix" the script (UTF8 and default might need other values but I assume these are the ones needed):
$InPath = 'C:\temp\ExportVideoChannelsInfoToCSV.ps1'
$OutPath = 'C:\temp\ExportVideoChannelsInfoToCSV_newencoding.ps1'
Get-Content -Path $InPath -Encoding UTF8 | Out-File -FilePath $OutPath -Encoding default
Or you can use a text editor (like Visual Studio Code) to reopen the file with different encodings until it looks allright.
Jul 19 2017 11:20 PM
Thank you so much for helping me out!
I really appreciate it
Jul 19 2017 11:23 PM
Thank you so much for explaining what was wrong. It was killing me not knowing.