[error] Method not found Issue

Product: PowerShell Universal
Version: 2.12.6

Hey everyone,

I am currently trying to run this, which was working without an issue,

$Job = Get-PSUScript -Integrated -Name 'Get-JumpCloudInactiveReport.ps1' | Get-PSUJob -OrderDirection Descending -First 1
Get-PSUJobPipelineOutput -Integrated -Job $Job
Get-PSUJobOutput -Job $Job

Now when I run it I receive this error message,

[error] Method not found: 'Void UniversalAutomation.ViewModels.PagedViewModel`1.set_Skip(System.Nullable`1<Int32>)'.

I did a bit of searching and found this post, Invoke-DbaQuery Not Working Anymore which talks about changing the Environment where the script runs. I am currently running the script in Windows PowerShell 5.1. Changing the Environment to Integrated yields a different error message,

[error] Specify a computer name or use the Connect-UAServer command.

Any suggestions on this? Thank you!

Missing “-Integrated” on Get-PSUJob on line 1, and on Get-PSUJobOutput on line 3?

Seems like an assembly mismatch. Do you have multiple versions of the Universal module installed?

Get-Module Universal -List

Hey Adam. I ran that command and it does not output any results. I did run this and found these two modules in the list, but I am not seeing anything else.

Get-Module -List
Script     1.0.0      UniversalDashboard.Style            New-UDStyle
Script     2.0.0      UniversalDashboard.UDSelectDateTime New-UDSelectDateTime

That did not resolve the issue. I appreciate the suggestion!

In your dashboard, you can do this.

$Data = [System.AppDomain]::CurrentDomain.GetAssemblies() | Select FullName, CodeBase
New-UDTable -Data $Data

The table will list out all loaded DLLs and you can check to make sure they are loading from where you expect.

Did you perform an upgrade on this or something and then it stopped working?

All PowerShell Universal items are loading from the same root location, file:///C:/inetpub/wwwroot/PowerShell_Universal

Should I be looking for a specific FullName in this or something that would stand out as being incorrect? I do see that Universal.Automation.Common is loading from file:///C:/inetpub/wwwroot/PowerShell_Universal as well.

I did complete an upgrade awhile ago that I believe affected this. I completed the upgrade by following the Zip Upgrade instructions.

Quick update on this. I re-ran the upgrade to 2.12.6, and now I do not receive the assembly mismatch error, but I do get,

[error] Specify a computer name or use the Connect-UAServer command.

I thought using the -Integrated parameter on Get-PSUScript would allow me to call cmdlets without an App Token or Computer Name. Am I missing something silly with this one?

The solution was,

$Job = Get-PSUScript -Integrated -Name 'Get-JumpCloudInactiveReport.ps1' | Get-PSUJob -OrderDirection Descending -First 1 -Integrated
Get-PSUJobPipelineOutput -Job $Job -Integrated
Get-PSUJobOutput -Job $Job -Integrated

Could have worded my reply a little better I guess, since it didn’t work on you first try :sweat_smile: