Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. $guests = Import-Csv -Path C:Usersshant_000DesktopUploadGuest_test.csv
  2. $output = gc '.Sample Json.json' | ConvertFrom-Json
  3. $array = New-Object System.Collections.ArrayList;
  4.  
  5. foreach($g in $guests){
  6.  
  7. $array.Add($output);
  8. $a = $array[$array.Count-1];
  9.  
  10. $a.Username = $g.'EmailAddress';
  11. $a.DisplayName = $g.'FirstName' + ' ' + $g.'LastName';
  12. $a.Password = $g.'LastName' + '123';
  13. $a.Email = $g.'EmailAddress';
  14.  
  15. foreach($i in $a.ProfileProperties.Count){
  16.  
  17. $j = $i - 1;
  18.  
  19. $prop = $a.ProfileProperties[$j];
  20.  
  21. if($prop.PropertyName -eq "FirstName")
  22. {$prop.PropertyValue = $g.'FirstName';}
  23.  
  24. elseif($prop.PropertyName -eq "LastName")
  25. {$prop.PropertyValue = $g.'LastName';}
  26.  
  27. $a.ProfileProperties[$j] = $prop;
  28.  
  29. }
  30.  
  31. $array[$array.Count-1] = $a;
  32. }
  33.  
  34. $array;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement