< Back
New-Donut
Post
NAME New-Donut
SYNOPSIS
Creates new Donuts to show some fundamental PowerShell concepts.
SYNTAX
New-Donut [-Identity] <String> [-Style] <String> [-Force] [<CommonParameters>]
DESCRIPTION
The purpose is simple: You input the arguments 'Style' and 'Identity'.
The function returns some very tasty Donut-Objects (PSCustom-Objects).
This is a nice way to get familiar with the object-oriented pipeline in PowerShell.
You can manipulate this output with many Cmdlets like Sort-Object or Set-Donut.
Welcome to the Donut shop!
******** Note that the baker has following business hours ********
Monday - Saturday
8:00 am - 3:00 pm
Outside this business hours you maye receive a PowerShell
exeption when trying to create new donuts.
Opened on public holidays!
************************************************************************
The Donut module showes following concepts:
- Writing functions (New-Donut, Set-Donut, Get-Donut)
- Use this fuctions to create a simple script-module (Learn-PowerShell-with-Donuts)
The functions demonstrate following concepts:
- Functions
- Input Arrays into you scripts
- Error Handling with try/catch
- Object-oriented pipeline
Instead of other Cmdlets like New-ADUser this function does not make any changes on your system.
In the background it saves the Donut-Objects in a global variable.
PARAMETERS
-Identity <String>
Specifies the name of the Donut. You may choose your own, unique identity for each Donut.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Style <String>
Determines what kind of Donut you want. Option are:
- Sugar
- Boston Creme
- Sprinkles
- Glazed
- Blue Sky
- Blueberry Crunch
Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Force [<SwitchParameter>]
You may force the Donut baker to make Donuts outside his business hours.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
This function was created and tested on macOS using Visual Studio Code (VS Code).
Therefore it is based on the functionality of .NET Core.
I formed this idea during a travel in ICE from Frankfurt to Nuremberg. We had some
technical problems on the train and stopped for a while. No Dunkin Donut was nearby.
So this code was born to create at least some virtual Donuts.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>New-Donut -Style 'Glazed'
Creates two Glazed Donuts.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Import-Csv $home\\order.csv | New-Donut
This is convenient for big orders.
It imports an order from a CSV and creates Donuts.
RELATED LINKS
http://github.com/rfc821/Learn-PowerShell-with-Donuts
SYNOPSIS
Creates new Donuts to show some fundamental PowerShell concepts.
SYNTAX
New-Donut [-Identity] <String> [-Style] <String> [-Force] [<CommonParameters>]
DESCRIPTION
The purpose is simple: You input the arguments 'Style' and 'Identity'.
The function returns some very tasty Donut-Objects (PSCustom-Objects).
This is a nice way to get familiar with the object-oriented pipeline in PowerShell.
You can manipulate this output with many Cmdlets like Sort-Object or Set-Donut.
Welcome to the Donut shop!
******** Note that the baker has following business hours ********
Monday - Saturday
8:00 am - 3:00 pm
Outside this business hours you maye receive a PowerShell
exeption when trying to create new donuts.
Opened on public holidays!
************************************************************************
The Donut module showes following concepts:
- Writing functions (New-Donut, Set-Donut, Get-Donut)
- Use this fuctions to create a simple script-module (Learn-PowerShell-with-Donuts)
The functions demonstrate following concepts:
- Functions
- Input Arrays into you scripts
- Error Handling with try/catch
- Object-oriented pipeline
Instead of other Cmdlets like New-ADUser this function does not make any changes on your system.
In the background it saves the Donut-Objects in a global variable.
PARAMETERS
-Identity <String>
Specifies the name of the Donut. You may choose your own, unique identity for each Donut.
Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Style <String>
Determines what kind of Donut you want. Option are:
- Sugar
- Boston Creme
- Sprinkles
- Glazed
- Blue Sky
- Blueberry Crunch
Required? true
Position? 2
Default value
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Force [<SwitchParameter>]
You may force the Donut baker to make Donuts outside his business hours.
Required? false
Position? named
Default value False
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
This function was created and tested on macOS using Visual Studio Code (VS Code).
Therefore it is based on the functionality of .NET Core.
I formed this idea during a travel in ICE from Frankfurt to Nuremberg. We had some
technical problems on the train and stopped for a while. No Dunkin Donut was nearby.
So this code was born to create at least some virtual Donuts.
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>New-Donut -Style 'Glazed'
Creates two Glazed Donuts.
-------------------------- EXAMPLE 2 --------------------------
PS C:\\>Import-Csv $home\\order.csv | New-Donut
This is convenient for big orders.
It imports an order from a CSV and creates Donuts.
RELATED LINKS
http://github.com/rfc821/Learn-PowerShell-with-Donuts