I have written this code
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[Int32]$BoxAlert,
[Parameter(Mandatory=$true)]
[Int32]$MailAlert
)
)
powershell.exe -WindowStyle Hidden {
if ($timeSpan.Days -ge $BoxAlert) {
drawPopupBox $result
}
if ($timeSpan.Days -ge $MailAlert) {
sendMail $result;
}
}
How to pass that $BoxAlert and $MailAlert inside the powershell.exe scriptblock?
Out-Nullor>$null 2>&1would be a much easier solution.powershell.exe -WindowStyle Hidden? Also, note that you have a spurious closing parenthesis after yourParam()block.