All,
I am working on a function, and in the function I would like to use another function which I have created as a parameter. For below, I would like to bring up a calendar selector that I have created (Select-Date) as a prompt after you've run the Add-TempLocalAdmin function. Is there a better way to do this? Should I just take the date selection out of the parameters and call it below in the Begin block (not shown)? If this is the right way, how to I make the Select-Date parameter available?
function Add-TempLocalAdmin {
[CmdletBinding()]
param(
[Parameter(Position=0, ValueFromPipeline=$true, Mandatory=$true)]
[string[]]$ComputerName,
[Parameter(Position=1, Mandatory=$true)]
[string]$Trustee,
[Parameter(Mandatory=$true)]
[string]$Requester,
[Parameter(Mandatory=$true)]
[string]$ServiceNowCR,
[Parameter(Mandatory=$true)]
[datetime]$StartDate = Select-Date,
[Parameter(Mandatory=$true)]
[datetime]$EndDate = Select-Date,
[Parameter(Mandatory=$true)]
[string]$Grantor = $env:USERNAME
)
Write-Host $ComputerName $Trustee $Requester $ServiceNowCR $StartDate $EndDate $grantor
}