Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [CmdletBinding()]
- Param(
- [Alias('Boss')]
- [Parameter(Mandatory,Position=0)]
- [Microsoft.ActiveDirectory.Management.ADUser]$Manager,
- [Alias('User')]
- [Parameter(Mandatory,Position=1)]
- [Microsoft.ActiveDirectory.Management.ADUser]$Employee,
- [Alias('ID','TrackingNo','Reference')]
- [Parameter(Mandatory,Position=2)]
- [uint32]$TrackingNumber,
- [Alias('Workstation','Machine','Computer')]
- [Parameter(Mandatory,Position=3)]
- [string]$ComputerName,
- [Alias('TicketID','TicketReference','Ticket')]
- [Parameter(Mandatory,Position=4)]
- [uint32]$TicketNumber,
- [Alias('NewEmail','CreateEmailAddress')]
- [Parameter(Mandatory,Position=5,ParameterSetName='NewHire')]
- [System.Net.Mail.MailAddress]$NewHireEmail,
- [Alias('InitializationText')]
- [Parameter(Position=6,ParameterSetName='NewHire')]
- [string]$NewHireText = "Default new hire text here.",
- [Alias('NewHirePassword','UserPassword')]
- [Parameter(Position=7,ParameterSetName='NewHire')]
- [securestring]$Password = (Read-Host -Prompt "Enter initial password for user:" -AsSecureString),
- [Alias('VanillaImage','VanillaImg','BaseImg')]
- [Parameter(Mandatory,Position=5,ParameterSetName='BaseMigration')]
- # Replace this type with appropriate type for whatever your input is supposed to be here
- [PsObject]$BaseImage,
- [Alias('MoveEmail','MigrateEmail','MoveAddress','MigrateAddress')]
- [Parameter(Mandatory,Position=6,ParameterSetName='BaseMigration')]
- [System.Net.Mail.MailAddress]$MigrationEmailAddress,
- [Alias('MigrateText')]
- [Parameter(Position=7,ParameterSetName='BaseMigration')]
- [string]$MigrationText = "Default migration text here.",
- [Alias('CannedResponse')]
- [Parameter(Position=8,ParameterSetName='NewHire')]
- [Parameter(Position=8,ParameterSetName='BaseMigration')]
- [string]$AutoReply = "Default autoreply text here."
- )
- Begin {
- function Complete-AssetDeployment {
- [CmdletBinding()]
- Param(
- # ???
- )
- # No idea what you're trying to do with this one yet. Try to define it more clearly.
- }
- <#
- This one's also up to you, as the specifics depend heavily on your environment.
- The relevant help file(s) can be found here:
- https://technet.microsoft.com/en-us/library/aa998225(v=exchg.160).aspx
- Specifically, you'll need to connect to a mailbox and use New-MailMessage
- to create the email. Suggested script parameters are listed below.
- #>
- function New-AutomatedMailMessage {
- [CmdletBinding()]
- Param(
- [Alias('To')]
- [Parameter(Mandatory,Position=0)]
- [ValidateNotNullOrEmpty()]
- [System.Net.Mail.MailAddress[]]$Recipients,
- [Alias('Cc')]
- [Parameter(Position=1)]
- [System.Net.Mail.MailAddress[]]$CarbonCopies,
- [Alias('Bcc')]
- [Parameter(Position=2)]
- [System.Net.Mail.MailAddress[]]$BlindCarbonCopies,
- [Parameter(Position=3)]
- [string]$Subject,
- [Alias('Message')]
- [Parameter(Mandatory,Position=4)]
- [string]$Body
- )
- # Function body goes here.
- }
- function Reset-ADUserPassword {
- [CmdletBinding()]
- Param(
- [Alias('Username','SamAccountName','Name')]
- [Parameter(Mandatory,Position=0,ValueFromPipeline)]
- [string]$Identity,
- [Alias('NewPassword')]
- [Parameter(Position=1)]
- [securestring]$Password = (Read-Host -Prompt "Enter initial password for user:" -AsSecureString),
- [Parameter(Position=2)]
- [switch]$ChangeAtLogon
- )
- Set-ADAccountPassword -Identity $Identity -Reset -NewPassword $Password
- Set-ADUser -Identity $Identity -ChangePasswordAtLogon ([bool]$ChangeAtLogon)
- }
- }
- Process {
- switch ($PSCmdlet.ParameterSetName) {
- 'NewHire' {
- Write-Verbose "Performing New Hire functionality."
- # Call appropriate functions with appropriate parameters and do whatever else you need to here
- }
- 'BaseMigration' {
- Write-Verbose "Performing Base Migration functionality."
- # Same here, for the other purpose of the script
- }
- }
- }
- End {
- <#
- This section is for cleanup. Any remaining open connections, mailboxes, sockets, streams, etc.,
- that need to be tidied up should be taken care of here and properly disposed of.
- #>
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement