2011-10-27 13 views
1

PowerShell v2内からReportingService2005.FindItems()メソッドを呼び出す際に問題が発生しました。エラーが発生しました。特にBooleanOperatorEnumパラメータに関して

引数「1」、値を変換できません:「SSRS.ReportingService2005.BooleanOperatorEnum」と入力する「FindItems」のために、「そして」:「に変換できません上記の実行

$rs = New-WebServiceProxy -Uri $ReportServerUri -Namespace SSRS.ReportingService2005 -UseDefaultCredential; 

$searchCondition = New-Object SSRS.ReportingService2005.SearchCondition 
$searchCondition.ConditionSpecified = $true 
$searchCondition.Name = "Name"; 
$searchCondition.Value = "Sales"; 
[SSRS.ReportingService2005.SearchCondition[]] $searchConditions = @($searchCondition) 

$boolOp = [SSRS.ReportingService2005.BooleanOperatorEnum]::And 

#Also tried bellow initialization of enum. 
#[SSRS.ReportingService2005.BooleanOperatorEnum] $boolOp = 0 

$rs.FindItems("/", $boolOp ,$searchConditions) 

は、次のエラーを与えます。「SSRS.ReportingService2005.BooleanOperatorEnum」エラータイプに値「と」:「 『SSRS.ReportingService2005.BooleanOperatorEnum』から 『SSRS.ReportingService2005.BooleanOperatorEnum』から無効なキャストを」」

すべてのヘルプは大、 をいただければ幸いですザック

答えて

2

私のwebproxyで使用されている名前空間パラメータに関連するエラーを特定しました。それが判明したので、投稿されたスクリプトは、セッションで初めて実行されたときに正常に実行されます。同じpowershellセッションで連続して実行すると失敗します。 http://www.vistax64.com/powershell/273120-bug-when-using-namespace-parameter-new-webserviceproxy.html

$rs = New-WebServiceProxy -Uri $ReportServerUri -UseDefaultCredential; 

$searchCondition = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1er_ReportService2005_asmx_WSDL.SearchCondition; 
$boolop = New-Object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1er_ReportService2005_asmx_WSDL.BooleanOperatorEnum; 
:かなりよく事情を説明し、この記事を見つけた

関連する問題