csv
2 TopicsPowershell bulk creation - error with UserPrincipalName
Hi I use a simple script (and it works) to bulk create new users on my M365 tenant (cloud based only). When I set the UserPrincipalName to e.g. [jan . jensen @ DOMAIN . onmicrosoft . com] it works (disregard the spaces, if I didn't use spaces in the example, the email gets removed by the editor). When I set the UserPrincipalName to e.g. [jan.jansen@DOMAIN.dk] it doesn't work. I'm missing something here, because, I assumed that the UserPrincipalName also could be the new email address. What do I need to in order to also create a valid email address as well? Below is the online script, and the CSV file it references. Import-Csv -Path "C:\Users\Jens Jakobsen\users.csv" | ForEach {New-MsolUser -DisplayName $_.DisplayName -FirstName $_.FirstName -LastName $_.LastName -UserPrincipalName $_.UserPrincipalName -UsageLocation $_.UsageLocation -LicenseAssignment $_.AccountSkuId} | Export-Csv -Path "C:\Users\Jens Jakobsen\Results.csv" Thanks.Solved3.4KViews0likes7CommentsExport Import CSV - help please :)
Hi Everyone I am currently creating a script that consists of a lot of small tasks, ending with the result being an Excel Report for the management team. But one part is giving me some trouble, so new i seek your help. I have a number of CSV filers with the following rows: "computer";"lastseen";"doccount" I am only interested in the "computer" row, which contains computer names on client machines. I need to end up with a CSV file with only that row + the column data. I have been trying to do the following: Get-content -Path Pathtosource\sourcefile.csv | Select-Object -Property computer | Export-Csv -path Pathtodestination\destinationfile.csv -NoTypeInformation To get it done in one command. But all i get is a CSV file with the text "computer" and nothing else. All the column data is missing. I have been trying this also: $ElasticBDContent = Get-content -Path PathtoSource\Sourcefile.csv $ElasticBDContent = $ElasticBDContent | Select-Object -Property computer $ElasticBDContent | Export-Csv -path PathtoDestination\Destinationfile.csv -NoTypeInformation Giving me the exact same result, a CSV file with the following content: "computer" This is the content i am looking for: "computer" "computer1" "computer2" "computer3" Can anyone give an example on how to achieve this? Any help is much appreciated. Thanks in advance.Solved1.4KViews0likes3Comments