I have beenÂ reading through the excellentÂ free eBooks published by Don Jones and amÂ very interested to make useÂ of theÂ Â modules provided with 'Making Historical and Trend Reports in PowerShell'. Whilst I was able to quickly get both the 'get' and 'save' commandsÂ working pretty quickly I didÂ unfortunately confirmÂ the module does require v3 to work correctly and the production server I need to use them onÂ is Server 2003 so can only support PS v2.0. My solution to this is to for the first time attempt to within a script use implicit remoting to enable the execution of these modules remotely. The issue I have encountered is when I run my script on my 2003 Server I get the following error...
Save-ReportData Error Message: (See attached screen capture)
Invoke-Command : Illegal type name on input object – aborting – please read the book!
I have been able to successfully get database table results whilst in the debug mode of my script copied below using the Get-ReportData however I get errors when attempting to pass and object containing new table data to the Save-ReportData command. As the Get-ReportData is working I know the module is working over the implicit remoting session.
My issue appears to be the custom $object I created isn't being piped correctly to the Save-RemReportData module with the â€˜type nameâ€™ intact. When I do a Get-Member onÂ $Object IÂ can visually confirm theÂ type nameÂ exists andÂ is correctly formatted.
This is quite frustrating as I am very keen to get a handle on how to utilize these free modules so inÂ future I can have scripts log to an SRS DB for much easier monitoring of automated solutions.
Does anyone have any suggestions???
Also please don't critique the current script too much, I am just in the process of getting base functionally working. 😉
Â PS1 SCRIPT
< # 05/06/2013 Ben Morris The purpose of this script is to set SCCM instance rights for new 'Software Distribution' (SD) collections to enable remote teams more granular access to the SCCM central site server. /#>
$DebugPreference = 'Inquire'
If($siteCode -eq 'CSS')
$Pass = ConvertTo-SecureString -string "NotaRealPassword" -asplaintext -force
$Session = New-PSSession -computerName SERVER02 -Credential $Creds #Server with PSv3 and SQL reporting modules.
#Logging Permission Changes to SRS reporting DB.
Remove-PSSession -session $session
Objects sent over Remoting get serialized and then de-serialized; I didn't really design the module to understand that. You'd probably be better off just hitting your database directly. The module is really just meant as a "I don't know SQL" shortcut. You clearly do know some SQL though 🙂 and if you access the DB directly then you can run all the code on your server, since you'd just be using the SqlClient .NET classes
You must be logged in to reply to this topic.