question

ClintonvanAxel-5933 avatar image
0 Votes"
ClintonvanAxel-5933 asked IanXue-MSFT answered

Why cant i remove the suffix from import-csv

I want to remove the suffix from an import-csv UPN

But i keep getting that the value is null.

 $ADUsers = Import-Csv C:\temp\guid.csv -Delimiter ";"
    
 ForEach ($User in $ADUsers) { 
 %{$User.UserPrincipalName.Split('@')[0]}
 }
windows-server-powershell
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

RichMatheisen-8856 avatar image
0 Votes"
RichMatheisen-8856 answered

Have you verified that the CSV contains a column named "UserPrincipalName"?

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

IanXue-MSFT avatar image
0 Votes"
IanXue-MSFT answered

Hi,

Is the value of $ADUsers.UserPrincipalName null? If so, please check the header and the delimiter of the CSV file.

Best Regards,
Ian Xue
============================================
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.