New-WebServiceProxy error when working to script out SSRS report definitions

  • I'm running a powershell script to output SSRS report definitions to a local folder in my machine.

    I downloaded the script from http://www.sqlmusings.com/2011/03/28/how-to-download-all-your-ssrs-report-definitions-rdl-files-using-powershell/.

    Here is an excerpt:

    [void][System.Reflection.Assembly]::LoadWithPartialName("System.Xml.XmlDocument");

    [void][System.Reflection.Assembly]::LoadWithPartialName("System.IO");

    $ReportServerUri = "http://abcd:81/ReportServer/ReportService2005.asmx";

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

    ...

    When I run the script I get this error:

    The term 'New-WebServiceProxy' is not recognized as the name of a cmdlet, function, script file, or operable program...

    Am I missing an assembly reference?

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • Which version of PowerShell are you running?

    "Applies to PowerShell 2.0"

    http://technet.microsoft.com/en-us/library/dd315258.aspx

    You can check by running this in a PowerShell session like this:

    PS C:\> $Host.Version

    Major Minor Build Revision

    ----- ----- ----- --------

    2 0 -1 -1

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Here is what I get:

    Major Minor Build Revision

    ----- ----- ----- --------

    2 0 -1 -1

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • It looks like we are running the same version...however I do not receive the error mentioned in your OP.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • I got the script to work by launching powershell from Start --> Run and typing powershell, clicking OK.

    However, when I launch powershell from SQL Server Management Studio (SQL-2008), I get the error in my OP.

    I wonder why this difference in behavior...

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

  • Ahhh...when you launch PowerShell from SSMS I think you're actually running a SQLPS session which is a mini-shell (real term :-)) different from a standard PS shell.

    See section "Adding the SQL Server Snap-ins to Windows PowerShell" in:

    http://msdn.microsoft.com/en-us/library/cc281962.aspx#sectionToggle4

    Thanks for posting back. I did not think to ask how you launched PS but will keep that in mind for future reference.

    There are no special teachers of virtue, because virtue is taught by the whole community.
    --Plato

  • Thanks for the link, I'll have a look.

    Now that I have got this to work, I can get down to the business of automating some of the tasks I have been doing manually lately.

    Like copying reports from one server to another using Report Manager; does not get any dummer than that... :w00t:

    __________________________________________________________________________________
    SQL Server 2016 Columnstore Index Enhancements - System Views for Disk-Based Tables[/url]
    Persisting SQL Server Index-Usage Statistics with MERGE[/url]
    Turbocharge Your Database Maintenance With Service Broker: Part 2[/url]

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply