From 03ba8a36beae7b4c4cdd510bd6a2d0477b55fc28 Mon Sep 17 00:00:00 2001 From: "Jeffrey A. Robinson" Date: Tue, 3 Oct 2017 10:24:38 -0700 Subject: [PATCH] New-ServiceClient error on custom host --- PSSwagger/New-ServiceClient.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PSSwagger/New-ServiceClient.ps1 b/PSSwagger/New-ServiceClient.ps1 index 1b84c90..81945ab 100644 --- a/PSSwagger/New-ServiceClient.ps1 +++ b/PSSwagger/New-ServiceClient.ps1 @@ -85,7 +85,8 @@ function New-ServiceClient { $Client = New-Object -TypeName $FullClientTypeName -ArgumentList $ClientArgumentList if ($HostOverrideCommand) { - $Client.BaseUri = Invoke-Command -ScriptBlock [scriptblock]::Create($HostOverrideCommand) + [scriptblock]$HostOverrideCommand = [scriptblock]::Create($HostOverrideCommand) + $Client.BaseUri = Invoke-Command -ScriptBlock $HostOverrideCommand } if ($GlobalParameterHashtable) {