Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $guests = Import-Csv -Path C:Usersshant_000DesktopUploadGuest_test.csv
- $output = gc '.Sample Json.json' | ConvertFrom-Json
- $array = New-Object System.Collections.ArrayList;
- foreach($g in $guests){
- $array.Add($output);
- $a = $array[$array.Count-1];
- $a.Username = $g.'EmailAddress';
- $a.DisplayName = $g.'FirstName' + ' ' + $g.'LastName';
- $a.Password = $g.'LastName' + '123';
- $a.Email = $g.'EmailAddress';
- foreach($i in $a.ProfileProperties.Count){
- $j = $i - 1;
- $prop = $a.ProfileProperties[$j];
- if($prop.PropertyName -eq "FirstName")
- {$prop.PropertyValue = $g.'FirstName';}
- elseif($prop.PropertyName -eq "LastName")
- {$prop.PropertyValue = $g.'LastName';}
- $a.ProfileProperties[$j] = $prop;
- }
- $array[$array.Count-1] = $a;
- }
- $array;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement