User not logged in - login - register
Home Calendar Books School Tool Photo Gallery Message Boards Users Statistics Advertise Site Info
go to bottom | |
 Message Boards » » Powershell WebServiceProxy "Nothing" paramater Page [1]  
AntecK7
All American
7755 Posts
user info
edit post

Okay,

So i'm trying to use powershell to pull some information about some Sql Server Reportin Server reports.

I've got my connection to the reporting service

http://technet.microsoft.com/en-us/library/reportservice2010.reportingservice2010.getitemparameters.aspx

and i'm trying to use the "GetItemParamters" method.

The code provided for VB, and other languages specifies sending the HistoryID to "Nothing" in VB.

I'm using powershell, but I cannot fathom "Nothing" in Powershell.

I've tried, $null, tried creating a variable then setting it=nothing..

Powershell doesn't seem to be able to pass "Nothing" to a SOAP query, and $null is actually a variable of a type of string in powershell.

$rs.GetItemParameters($report.path,$Null,$false,$PRVALUE,$PRCRED)
Exception calling "GetItemParameters" with "5" argument(s): "The parameter value provided for
'snapshotID' does not match the parameter type. --->
Microsoft.ReportingServices.Diagnostics.Utilities.ParameterTypeMismatchException: The parameter value
provided for 'snapshotID' does not match the parameter type. ---> System.Exception: For more
information about this error navigate to the report server on the local server machine, or enable
remote errors"
At line:1 char:1
+ $rs.GetItemParameters($report.path,$Null,$false,$PRVALUE,$PRCRED)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: ( [], MethodInvocationException

4/29/2014 5:38:05 PM

qntmfred
retired
40722 Posts
user info
edit post

try the workarounds here

https://connect.microsoft.com/PowerShell/feedback/details/307821/it-isnt-possible-to-pass-null-as-null-into-a-net-method-that-has-a-parameter-of-type-string

[Edited on April 29, 2014 at 7:44 PM. Reason : it's not on that link, but does passing [NullString]::Value work?]

4/29/2014 7:28:21 PM

AntecK7
All American
7755 Posts
user info
edit post

I'll try it when i'm back at work...

I got it working using invoke on a different method, but its still kinda frustrating. My new job kinda limits me to Powershell, so while i'm learning it its taking me a hell of a lot longer to do some tasks that took me minutes in VS.

http://social.technet.microsoft.com/Forums/en-US/bb99577b-ab67-4c78-a240-efa641b4c161/powershell-using-null-for-object-properties-in-web-services?forum=ITCG

is another interesting site on the problem..

Currently i'm working on hitting the following services

BigFix, SSRS, and possibly a few other systems, I'm hoping they all have SOAP interfaces.

4/29/2014 9:17:51 PM

lewisje
All American
9196 Posts
user info
edit post

use JScript, send to null

[Edited on April 29, 2014 at 9:18 PM. Reason : nvm, just saw you have to use PowerShell

4/29/2014 9:18:26 PM

AntecK7
All American
7755 Posts
user info
edit post

Im hoping at some point i can provide enough value that they open up the door to using some actual developer level tools. Right now there is a lot of fear i think because most of the staff still aren't strong in powershell, heck some have very little scripting and programming experience at all.

There is a lot of hesitation about writing any code that another person cannot immidiatly go in behind you and instantly understand and understand. Commenting helps, but frankly it can only go so far if someone hasn't programmed in the last 15+ years

That being said, powershell isn't a bad skill to have, so I don't mind beefing up a little bit more on it. Its an improvement over VBScript for sure, but I didn't realize how comfortable I had become using VS.


Access on the other hand... Dear god why can't they improve VBA jesus.

4/29/2014 11:56:16 PM

AntecK7
All American
7755 Posts
user info
edit post

$nothing=[System.Management.Automation.Language.NullString]::Value
$RS.GetItemParameters($myreport.$nothing,$null,$false,$nothing,$nothing)

doesnt seem to work, nor does your suggestion...

Screw PS.

5/1/2014 2:03:43 PM

qntmfred
retired
40722 Posts
user info
edit post

$myreport.$nothing

period vs comma?

5/1/2014 3:02:08 PM

AntecK7
All American
7755 Posts
user info
edit post

frick stupid typo, ill double check that

5/1/2014 11:55:29 PM

Noen
All American
31346 Posts
user info
edit post

You can edit and debug powershell with intellisense in VS2013 I think

5/2/2014 2:25:09 PM

 Message Boards » Tech Talk » Powershell WebServiceProxy "Nothing" paramater Page [1]  
go to top | |
Admin Options : move topic | lock topic

© 2024 by The Wolf Web - All Rights Reserved.
The material located at this site is not endorsed, sponsored or provided by or on behalf of North Carolina State University.
Powered by CrazyWeb v2.39 - our disclaimer.