Skip to content

Instantly share code, notes, and snippets.

@JeffWouters
Created July 1, 2022 13:27
Show Gist options
  • Select an option

  • Save JeffWouters/117c06313f45cd11a0b4a816ef1be7b3 to your computer and use it in GitHub Desktop.

Select an option

Save JeffWouters/117c06313f45cd11a0b4a816ef1be7b3 to your computer and use it in GitHub Desktop.
Friducation
<#
.SYNOPSIS
A function to create a user.
.DESCRIPTION
A function to create a user on the AzureAD.
.PARAMETER FirstName
Provide the first name of the user to be created.
.PARAMETER LastName
Provide the last name of the user to be created.
.EXAMPLE
New-MthsUser -First 'Jeff' -Last 'Wouters'
.EXAMPLE
New-MthsUser 'Jeff' 'Wouters'
.EXAMPLE
Import-Csv -Path .\users.csv | ForEach-Object {New-MthsUser -First $_.First -Last $_.Last}
.EXAMPLE
Import-Csv -Path .\users.csv | New-MthsUser
.NOTES
Customer : KPN
Company : Methos
Author : Jeff Wouters
#>
function New-MthsUser {
param (
[parameter(
Mandatory=$true,
Position=0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true
)]
[Alias('First')]
[string]$FirstName,
[parameter(
Mandatory=$true,
Position=1,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true
)]
[Alias('Last')]
[string]$LastName
)
begin {
}
process {
try {
New-Item -ItemType File -Name "$FirstName-$LastName"
}
catch {
$_ | Write-Error
}
}
end {
}
}
Import-Csv -Path .\users.csv | New-MthsUser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment