I have 3 variables. Each variable is an array of users. I'm trying to create a CSV in PowerShell that contains these 3 arrays in separate headers, but the code I'm using isn't working.
Here's the code:
$buildcsv = @"
1st Notification, 2nd Notification, 3rd Notification
$1nclient, $2nclient, $3nclient
"@
$excsv = ConvertFrom-Csv $buildcsv
However the output only gives me the header, not the related list of users.
PS> $excsv 1st Notification 2nd Notification 3rd Notification ---------------- ---------------- ----------------
The output that I expect would look like this:
1st Notification 2nd Notification 3rd Notification
---------------- ---------------- ----------------
hi.microsoft.com [email protected] [email protected]
hello.microsoft.com [email protected]
[email protected]
Is there a reason why a variable of System.Array type wouldn't work?
$inputis an automatic variable that shouldn't be used as a regular variable.$1nclient,$2nclientand$3nclientdefined before$buildcsvI see the values in the output (although not in the format you expect). If you don't you either define the 3 lists after$buildcsv, or you have something in your code that you didn't tell us about.