The diagnostic "but doesn't work" is not at all helpful! What does it do? What doesn't it do? Are there errors displayed? What are they?
I've edited your script to correct the "add-lastname' to 'Add-Type', replaced the multiple occurrences of the Unicode "en-dash" where a hyphen was expected, and to properly terminate the line that should run the other script.
#add-lastname -AssemblyName microsoft.visualbasic # What the heck is "add-lastname"????
Add-Type -AssemblyName microsoft.visualbasic
$name = [Microsoft.VisualBasic.Interaction]::InputBox('Your first name', 'Your first name')
$middlename = [Microsoft.VisualBasic.Interaction]::InputBox('Your middle name', 'Your middle name')
$lastname = [Microsoft.VisualBasic.Interaction]::InputBox('Your last name', 'Your last name')
$age = [Microsoft.VisualBasic.Interaction]::InputBox('Your age', 'Your age')
$confirm = [System.Windows.Forms.MessageBox]::Show("d:\members\Addname.ps1 -Name $name -middlename $middlename -LastName $lastname -age $age", 'Command to run')
if ($confirm -eq 'OK') {
#i have tried adding several different lines here but doesn't work.
#i want to run this line from above:
d:\members\Addname.ps1 -Name $name -middlename $middlename -LastName $lastname -age $age # Command to run
}
Does this work? If not, HOW does it fail?