MessageBox.psm1
<#
=========================================================================== Created by: Rhys M Contact: RhysM.PS@gmail.com PS Gallery: https://www.powershellgallery.com/profiles/RhysM/ Filename: MessageBox.psm1 ------------------------------------------------------------------------- Module Name: MessageBox =========================================================================== #> Function MessageBox { Param ( [Parameter(Position = 0, Mandatory = $True)] $Message, [Parameter(Position = 1, Mandatory = $False)] $Title = "Notification", [Parameter(Position = 2, Mandatory = $False)] [ValidateSet('OK', 'OKCancel', 'AbortRetryIgnore', 'YesNoCancel', 'YesNo', 'RetryCancel')] $ButtonOption = 'OK', [Parameter(Position = 3, Mandatory = $False)] [ValidateSet('None', 'Info', 'Warning', 'Error')] $Icon = 'Info', [Parameter(Position = 4, Mandatory = $False)] [switch]$Void ) if ($Void){ [void][System.Windows.Forms.MessageBox]::Show("$Message", "$Title", "$ButtonOption", "$Icon") } else{ [System.Windows.Forms.MessageBox]::Show("$Message", "$Title", "$ButtonOption", "$Icon") } } Export-ModuleMember -Function MessageBox |