I have a PowerShell script that accepts 3 named parameters. Please let me know how to pass the same from command line. I tried below code but same is not working. It assigns the
One option:
$params = @{ P1 = 1 P2 = 2 P3 = 3 } $ScriptPath = 'D:\Test.ps1' $sb = [scriptblock]::create(".{$(get-content $ScriptPath -Raw)} $(&{$args} @params)") Invoke-Command -ComputerName server -ScriptBlock $sb