I have a main menu script where I ask for the user to enter admin credentials and I want to use them in other scripts that the main menu calls.
Here is my call to other scripts which launches the new script just fine and the called script runs.
Start-Process PowerShell.exe -ArgumentList "-noexit", "-command &$ScriptToRun -UserCredential $UserCredential"
In the called script I accept the parameters like this
#Accept User Credentials if sent from Main menu
param(
[parameter(ValueFromPipelineByPropertyName=$true,ValueFromPipeline=$true,Mandatory=$false)]
[PSCredential]$UserCredential
)
Instead of accepting the credentials, though, it is launching the prompt asking for credentials with the name of the object in the user field.
Any help would be greatly appreciated in figuring this out, as I am banging my head against the wall.

Start-Processto invoke new instances ofpowershell.exe?