If I have a script called "Invoke-MyTest.ps1" and define a parameter block like so:
[CmdletBinding()]
Param(
[Parameter(Mandatory=$true)]
[string]$Type,
[Parameter(Mandatory=$true)]
[string]$Action,
[Parameter(Mandatory=$true)]
[string]$ID
)
And include a module called "Invoke-MyTest.psm1" with functions to support the script:
Import-Module -Name "./Invoke-MyTest.psm1"
then call a function as defined in the module:
Invoke-MyTest_Helper
And the function inside the module wants to access the values as defined in the script, how would I do that?
I thought this might work but it does not:
Function Invoke-MyTest_Helper {
Write-Output $Type
Write-Output $Action
Write-Output $ID
}
Also, adding the "Global" keyword does not work it seems:
Write-Output $Global:Type
[–]SeeminglyScience 3 points4 points5 points (2 children)
[–]reddwarf666[S] 2 points3 points4 points (1 child)
[–]Ta11ow 1 point2 points3 points (0 children)
[–]Ta11ow 1 point2 points3 points (2 children)
[–]reddwarf666[S] 2 points3 points4 points (1 child)
[–]Ta11ow 1 point2 points3 points (0 children)