I have a PowerShell script which has couple of parameters including a switch parameter.
The below command executed within PowerShell works as expected:
\\localhost\Test\Code\DataPullResults.ps1 -TestName 'Test survey' -QUser 'sdasch@gmail.com' -SqlServerInstanceName localhost -SqlDatabaseName MyDatabase -Load:$True -ErrorAction Continue;
But when I ran the same command from command prompt I get an error:
\\localhost\Test\Code\DataPullResults.ps1 : Cannot process
argument transformation on parameter 'FullLoad'. Cannot convert value
"System.String" to type "System.Management.Automation.SwitchParameter".
Boolean parameters accept only Boolean values and numbers, such as $True,
$False, 1 or 0.
Below is the command which I have used to execute from the command prompt:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe powershell.exe -ExecutionPolicy ByPass -File \\localhost\Test\Code\DataPullResults.ps1 -TestName 'Test survey' -QUser 'sdasch@gmail.com' -SqlServerInstanceName localhost -SqlDatabaseName MyDatabase -Load:$True -ErrorAction Continue;
Here Load
is a Switch Parameter.