Created
December 8, 2024 19:41
-
-
Save rnwood/e026eef37528f70596957aa30b48ed6e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param ( | |
| [int]$RecordCount = 10 | |
| ) | |
| $firstNames = @("Oliver", "George", "Harry", "Jack", "Jacob", "Noah", "Charlie", "Muhammad", "Thomas", "Oscar") | |
| $lastNames = @("Smith", "Jones", "Taylor", "Brown", "Williams", "Wilson", "Johnson", "Davies", "Robinson", "Wright") | |
| $domains = @("gmail.com", "yahoo.com", "hotmail.com", "outlook.com") | |
| $random = New-Object System.Random | |
| (for ($i = 1; $i -le $RecordCount; $i++) { | |
| $firstName = $firstNames[$random.Next($firstNames.Count)] | |
| $lastName = $lastNames[$random.Next($lastNames.Count)] | |
| $domain = $domains[$random.Next($domains.Count)] | |
| $email = "$firstName.$lastName@$domain".ToLower() | |
| $phoneNumber = "07" + $random.Next(100000000, 999999999) | |
| $record = [PSCustomObject]@{ | |
| ID = $i | |
| FirstName = $firstName | |
| LastName = $lastName | |
| Email = $email | |
| PhoneNumber = $phoneNumber | |
| } | |
| Write-Output $record | |
| }) | ConvertTo-Json ` | |
| | Out-File -Encoding UTF8 contact.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment