You've got two problems:
Your test.ps1 doesn't declare any parameters so the $name and $id variables don't have values in test.ps1
If you want to pass multiple parameters to a function you use the format test $name $id or test -name $name -id $id, not test($name, $Id) - your version is equivalent to test -name @($name, $id) -id $null, that is, the brackets define an array value as a single parameter rather than enclose a list of parameters. See this question amongst several other similar ones with the same issue: PowerShell function parameters syntax
Fixed versions of files:
test.psm1
function test
{
param(
[string] $name,
[string] $Id
)
echo "Your name is $name"
echo "Your Id is $Id"
}
Export-ModuleMember -Function test
test.ps1
param(
$name,
$id
)
Import-Module ".\test.psm1" -Verbose -Force
test -name $name -id $Id
and you can then invoke it on the commandline as:
powershell .\test.ps1 -name "joke" -id 3
to get the output
Your name is joke
Your Id is 3