PowerShellPowerShell Functions

Real Fake Names

In some blog articles over 7 years I have been writing two functions to create real names to use with creating Active Directory Lab user accounts.

And when I started to go thru my blog post last year I saw that some of my older stuff was not in a good condition.
They was good back in the days!

Not so much now! 🙂

So I have been going thru my old blog and started to rebuild some of the old stuff in more modern ways.

The Get-SNames and Get-FNames functions was not working as they did in 2009 and 2012.
I have been using files with names and have not been using them to get names from internet in a while.

Now I have been working on a new solution for that this weekend and have come up with 4 functions.

This article is updated with my latest changes to the functions regarding given names.
In my first versions they was called First names and now they are called Given names.

Import-GivenNames
Import-SurNames
Get-GivenName
Get-SurName

Import-GivenNames and Import-SurNames will take names from internet sites and making files for offline use.
Get-GivenName and Get-SurName will read the imported files and show random names.

Why make offline files?
It’s possible to grab names one by one online, no problem.
But I run my functions to create random names like 10 000 times in a row and don’t wan’t that internet traffic.
10 000 times for first name and 10 000 times for surname.
It’s faster to get all names to offline first and then do the random stuff offline then do the random stuff online.

The functions have support for USA, Sweden and UK for now.

I’m using these websites to get the names:
http://www.scb.se
http://names.mongabay.com
http://www.names-surnames.com
http://www.behindthename.com

This new version using Invoke-WebRequest to get the information.
So the script must be run on a machine with PowerShell 3.0 or newer PowerShell.

Here is the code:

Import-GivenNames

Import-SurNames:

Get-GivenName:

Get-SurName:

To get some Real Fake Names we can do like this:

Lisa Hedlund
Vannessa Weber
Brody Graham
Kira Gunnarsson

Or like this:

These functions can do alot of nice stuff for making lab environments look like the real stuff.
Or they can be handy for lots of other scripts.

I will use them later in some articles when showing some of my Active Directory Functions for making AD users.

The script with the functions can be downloaded here.

Best Regards,
Fredrik

Leave a Reply

Your email address will not be published. Required fields are marked *