Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Somebody broke the CSV file #784

Open
mprentice22153 opened this issue May 8, 2024 · 10 comments
Open

Somebody broke the CSV file #784

mprentice22153 opened this issue May 8, 2024 · 10 comments

Comments

@mprentice22153
Copy link

Please review the format of the CSV file. It has been broken for a couple weeks.

When I run this, which is what I have used for the past few years:
$M365Products = convertFrom-CSV (Invoke-WebRequest -Uri $MicrosoftFileLocation).tostring()

and then:
$M365Products |gm

The output is:

TypeName: System.Management.Automation.PSCustomObject

Name MemberType Definition


Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
???Product_Display_Name NoteProperty string ???Product_Display_Name=10-Year Audit Log Retention Add On
GUID NoteProperty string GUID=c2e41e49-e2a2-4c55-832a-cf13ffba1d6a
Service_Plans_Included_Friendly_Names NoteProperty string Service_Plans_Included_Friendly_Names=Auditing 10Year Retention Add On
Service_Plan_Id NoteProperty string Service_Plan_Id=7d16094b-4db8-41ff-a182-372a90a85407
Service_Plan_Name NoteProperty string Service_Plan_Name=Auditing_10Year_ Retention_ Add_On
String_Id NoteProperty string String_Id=10_ALR_ADDON

What are those 3 question marks "???" in front of Product_Display_Name

Thank you.


Document Details

Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.

@Nicholak-MS
Copy link
Contributor

Hi @mprentice22153 not sure what is causing that to encode incorrectly. I republished another another version. Can you see if you are still hitting the issue? If so I will have to investigate further.

Thanks
Nick

@mprentice22153
Copy link
Author

mprentice22153 commented May 8, 2024

@Nicholak-MS Still getting the same problem. I'm not seeing the issue in the downloaded CSV when I get it direct from the website via a web browser. Interesting that it is the first field in the CSV.

Apologies for saying it has been happening for a couple weeks. I thought it was happening before I started my vacation in April but I can't find evidence. I've definitely been seeing it this week.

Not sure where the issue is currently

@TPavanBalaji
Copy link

@mprentice22153
Thanks for your feedback! We will investigate and update as appropriate.

@mprentice22153
Copy link
Author

I have not rebooted my system for almost a month but will soon and can test, just in case something is whacky.

When I download the CSV via a browser and save it, this works fine:

$temp = Import-Csv 'C:\Downloads\Product names and service plan identifiers for licensing.csv'
$temp | gm


   TypeName: System.Management.Automation.PSCustomObject

Name                                  MemberType   Definition
----                                  ----------   ----------
Equals                                Method       bool Equals(System.Object obj)
GetHashCode                           Method       int GetHashCode()
GetType                               Method       type GetType()
ToString                              Method       string ToString()
GUID                                  NoteProperty string GUID=c2e41e49-e2a2-4c55-832a-cf13ffba1d6a
Product_Display_Name                  NoteProperty string Product_Display_Name=10-Year Audit Log Retention Add On
Service_Plans_Included_Friendly_Names NoteProperty string Service_Plans_Included_Friendly_Names=Auditing 10Year Retention Add On
Service_Plan_Id                       NoteProperty string Service_Plan_Id=7d16094b-4db8-41ff-a182-372a90a85407
Service_Plan_Name                     NoteProperty string Service_Plan_Name=Auditing_10Year_ Retention_ Add_On
String_Id                             NoteProperty string String_Id=10_ALR_ADDON

@Nicholak-MS
Copy link
Contributor

Thanks @mprentice22153 for the testing assistance here from your side. I am able to confirm downloading from the site works as well. I haven't tried via PS. But curious to hear if rebooting helps your side. If not I will do a little reconfig on my side to see if we can get it working again.

Thanks
Nick

@Naveenommi-MSFT
Copy link
Contributor

Naveenommi-MSFT commented May 13, 2024

@Nicholak-MS
Thanks for your response.

@mprentice22153
We are going to close this thread, if there are any further questions regarding the documentation, please tag me in your reply and we will be happy to continue the conversation.
#Please-close

@mprentice22153
Copy link
Author

mprentice22153 commented May 13, 2024

@Nicholak-MS @Naveenommi-MSFT

This ticket should not have been closed. I have rebooted my system and confirmed I'm still seeing the 3 question marks. I've built a workaround into my function but I really shouldn't need to.

Function Get-M365ProductList {

    $MicrosoftFileLocation = 'https://download.microsoft.com/download/e/3/e/e3e9faf2-f28b-490a-9ada-c6089a1fc5b0/Product%20names%20and%20service%20plan%20identifiers%20for%20licensing.csv'

    write-output 'Downloading current product list from Microsoft website'
    try {
        $M365Products = convertFrom-CSV (Invoke-WebRequest -Uri $MicrosoftFileLocation -ErrorAction stop).tostring()
    } catch {
        $M365Products = $null
    }

    # Corrections to the file
    If ($M365Products) {
        # The CSV currently has/had "String_ Id" with a space!!!!
#        $M365Products | add-member -MemberType AliasProperty -Name 'String_Id' -Value 'String_ Id' -erroraction silentlycontinue
        $M365Products | add-member -MemberType AliasProperty -Name 'Product_Display_Name' -Value '???Product_Display_Name' -erroraction silentlycontinue
    }    

    Return $M365Products
}

$prods = Get-M365ProductList

$prods | gm



   TypeName: System.Management.Automation.PSCustomObject

Name                                  MemberType    Definition
----                                  ----------    ----------
Product_Display_Name                  AliasProperty Product_Display_Name = ???Product_Display_Name
Equals                                Method        bool Equals(System.Object obj)
GetHashCode                           Method        int GetHashCode()
GetType                               Method        type GetType()
ToString                              Method        string ToString()
???Product_Display_Name               NoteProperty  string ???Product_Display_Name=10-Year Audit Log Retention Add On
GUID                                  NoteProperty  string GUID=c2e41e49-e2a2-4c55-832a-cf13ffba1d6a
Service_Plans_Included_Friendly_Names NoteProperty  string Service_Plans_Included_Friendly_Names=Auditing 10Year Retention Add On
Service_Plan_Id                       NoteProperty  string Service_Plan_Id=7d16094b-4db8-41ff-a182-372a90a85407
Service_Plan_Name                     NoteProperty  string Service_Plan_Name=Auditing_10Year_ Retention_ Add_On
String_Id                             NoteProperty  string String_Id=10_ALR_ADDON


@Nicholak-MS
Copy link
Contributor

Hi @mprentice22153 I have taken down the CSV and rebuilt from an entirely new csv file and made it available to download. Curious if this solves the encoding issue you are running in to. Can you please run a test?

Thanks,
Nick

@mprentice22153
Copy link
Author

@Nicholak-MS
So weird. I just tested this morning and I'm getting the same results. Do you see the same issue when you run my code from above? Wondering now if this is a PowerShell version/module issue.

My workaround works and my scripts are working again but odd that this is happening. I guess you'll just have to turn it into an API request and forego the CSV. ;-)

$psversiontable

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

@Naveenommi-MSFT Naveenommi-MSFT added assigned-to-author Issue assigned to author and removed cxp labels May 15, 2024
@Nicholak-MS
Copy link
Contributor

Hi @mprentice22153 , can you help me to test a theory please? I think I traced the timing of the start of this issue back to a new row that was added that starts with digits, it is the only row of its kind... So I removed the row temporarily to see if that is the root of the issue. Could you try your original PS code and see if that removes the "???". Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants