Active Directory Star Wars PowerShell Module

Active Directory Star Wars PowerShell Module

Hello,

Some time ago I talk about how to create Active Directory users based on the Star Wars world. This will help you to create some good tests users for your labs or demo instead of User1, User2 and so on.I use this on a regular basis when I need to build a demo for a client, the benefit of this is that you can use it for all kind of demos:

  • Active Directory
  • Office 365
  • Access Permission
  • Etc…

So I decided to enhance the script and turn it into a module for better sharing and usability.

Active Directory Star Wars PowerShell Module – Download

You can download the module on the PowerShell Gallery.

From Powershell with PackageManagement (included in Win10/Server2016):

Install-Module -Name StarWars -Scope CurrentUser
Active Directory Star Wars PowerShell Module - Install Module

Active Directory Star Wars PowerShell Module – Install Module

Note: Setting the install scope to “CurrentUser” allows you to install a module without admin permission on the operating system and it will install it only for you, in your own PSModulePath: %userprofile%\documents\WindowsPowerShell\Modules.

Once installed, you can see the included functions in it:

Get-Command -Module StarWars
Active Directory Star Wars PowerShell Module - Functions

Active Directory Star Wars PowerShell Module – Functions

For each function in this module, you can use the Get-Help cmdlet to lean more about how it works and what it does:

Get-Help -Name New-StarWarsADUser -ShowWindow
Active Directory Star Wars PowerShell Module - Help New-StarWarsAdUser

Active Directory Star Wars PowerShell Module – Help New-StarWarsAdUser

New-StarWarsADUser

This function will create all the users available on the swapi.co in you local Active Directory. The function accepts a “Path” parameter to specify the organizational unit where you want them to be created, or, by default, it will create them in the default user location.

You can also choose the password that will be associated with the users, the UserPrincipalName suffix and the mail domain.

Active Directory Star Wars PowerShell Module - New-StarWarsAdUser

Active Directory Star Wars PowerShell Module – New-StarWarsAdUser

New-StarWarsADUser -Path 'OU=Users,OU=Star Wars,OU=Prod,DC=D2K16,DC=itfordummies,DC=net' -PassThru | Format-Table -AutoSize

New-StarWarsADGroup

This function will create groups based on the species and movies found in the swapi.co API. You can also specify a custom path to create them in the organizational unit of your choosing.

New-StarWarsADSite

This function will create sites based on the planets found on the swapi.co API.

Add-StarWarsADUserToAdGroup

Once you created the users and the groups, you can use this function to add some users to the groups. Each users will be able in the movies they appear in, and they also will be added in their specie’s group.

Note: There is no magic, the users and the groups must be created before running this one.

Invoke-StarWarsTheme

This function will use the buzzer of your computer and try to do its best to sing the Star Wars music theme.

Remove-StarWarsADGroup

This function will delete all the groups created previously.

Remove-StarWarsADSite

This function will delete all the sites created previously.

Remove-StarWarsADUser

This function will delete all the users created previously.

Conclusion

I hope you’ll envoy this module to build some great demo to your clients, management, teams with friendly names as users!

One thought on “Active Directory Star Wars PowerShell Module

  1. Pingback: Publish Script Module PowerShell Gallery - It for DummiesIt for Dummies

Leave a Reply