2016-08-17 3 views
0

이 코드의 끝 부분에서 숨김 속성을 "True"로 설정했지만 Report Manager 인터페이스에 계속 표시됩니다. 누구든지이 속성을 ReportService2010과 함께 PowerShell을 사용하여 설정하는 방법을 알고 있습니까?ReportService2010을 사용하여 PowerShell에서 SSRS 보고서의 숨김 속성을 "True"로 설정하려면 어떻게해야합니까?

 $reportServerUri = "http://local/ReportServer_SQL2014/ReportService2010.asmx?wsdl" 
    $rs = New-WebServiceProxy -Uri $reportServerUri -UseDefaultCredential 

    $proxyNamespace = $rs.GetType().Namespace 

    $targetFolderPath = "/My Reports" 
    $targetDatasourceRef = "/SharedDataSources/sdsHP" 
    $warnings = $null 
    $sourceFolderPath = "C:\Reports" 

    Get-ChildItem $sourceFolderPath -Recurse -Filter "*.rdl" | Foreach-Object { 
$reportName = [System.IO.Path]::GetFileNameWithoutExtension($_.Name) 
$bytes = [System.IO.File]::ReadAllBytes($_.FullName) 

Write-Output "Uploading report ""$reportName"" to ""$targetFolderPath""..." 
$report = $rs.CreateCatalogItem(
    "Report",   # Catalog item type 
    $reportName,  # Report name 
    $targetFolderPath,# Destination folder 
    $true,   # Overwrite report if it exists? 
    $bytes,   # .rdl file contents 
    $null,   # Properties to set. 
    [ref]$warnings) # Warnings that occured while uploading. 

$warnings | ForEach-Object { 
    Write-Output ("Warning: {0}" -f $_.Message) 
} 

# Set the Hidden property of the reports. 
    $report.Hidden = "True" 
    $report.HiddenSpecified = "True" 

}   

답변

0

이 더 복잡하지만, SMO 사용, 나를 위해 작동 :

# Set the Hidden property of subreports using SMO. 
    $smodb = New-Object Microsoft.SqlServer.Management.Smo.Database 
    $smodb = $smoServer.Databases.Item("ReportServer") 
    $smodb.ExecuteNonQuery("UPDATE ReportServer.dbo.Catalog SET Hidden =1 WHERE [Name] = '$ReportName' AND [Type] =2;")