$parms = @{
ComputerName = 'mike';
ComputerId = 'SYS 001'
}
#Display hashtable
$parms.Keys
$parms.Values
$filePath = ".\Test 1B-receiving script.ps1"
$commandLine = "-NoExit & `'$filePath`' $parms"
Write-Host `n$commandLine -f Cyan
Start-Process Powershell.exe -ArgumentList $commandLine
Param(
$parms2
)
Write-Host "Made it to test 1B."
Write-Host $parms2 -ForegroundColor Yellow
Write-Host $parms2.ComputerName -ForegroundColor Gray
Made it to test 1B.
System.Collections.Hashtable
The property 'ComputerName' cannot be found on this object. Verify that the property exists.
At: C:\Workshop\PowerShell-work\Passing arguments\Test 1B-receiving script.ps1:61 char:1
+Write-Host $parms2.ComputerName -ForegroundColor Gray
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.