Created
October 17, 2018 21:58
-
-
Save dgosbell/618880448d67714be470a794434e3714 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Turns remote errors on or off for an instance of Power BI Report Server | |
.PARAMETER $enabled | |
a boolean that controls whether remote errors are enabled or not | |
.INPUTS | |
None - you cannot pipe into this function | |
.OUTPUTS | |
None | |
.EXAMPLE | |
set-RsRemoteErrors $true | |
.EXAMPLE | |
set-RsRemoteErrors $false | |
#> | |
function set-RsRemoteErrors ($enabled) | |
{ | |
(New-Object System.Net.WebClient).Proxy.Credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials | |
$url = "https://insights-reports.tst.metrotrains.com.au/reportserver/reportservice2010.asmx?wsdl" | |
$pbirs = New-WebServiceProxy -Uri $url -UseDefaultCredential # -namespace PowerBIReportServer -class pbirs | |
#HACK: need to use the default autogenerated namespace, as using the namespace parameter above results | |
# in duplicate temporary assemblies with the same namespace being generated which results in casting errors | |
#$p = new-object PowerBIReportServer.Property | |
$p = new-object Microsoft.PowerShell.Commands.NewWebserviceProxy.AutogeneratedTypes.WebServiceProxy1er_reportservice2010_asmx_wsdl.Property | |
$p.Name = "EnableRemoteErrors" | |
# Declare an array of properties | |
$props = ,$p | |
# Turn on Remote Errors | |
$p.Value = $enabled | |
$pbirs.SetSystemProperties($props) | |
# Confirm that Remote Errors are enabled | |
$pbirs.GetSystemProperties($props) | |
$pbirs.Dispose() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment