Invoke-UAScript not working after upgrade from 1.5.16 to 2.1.0

Product: PowerShell Universal
Version: 2.1.0

Good evening,

after upgrading from 1.5.16 Invoke-UAScript seems not to be working anymore. I always get the error:

Invoke-UAScript : Cannot retrieve the dynamic parameters for the cmdlet. Response could not be deserialized to JSON:
GET https://psuxchg.lkw-walter.com/api/v1/Script/set-mailboxrecipientlimit.ps1
At line:1 char:1
+ Invoke-UAScript -Script "$Script.ps1" -Json $Json
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-UAScript], ParameterBindingException
    + FullyQualifiedErrorId : GetDynamicParametersException,UniversalAutomation.InvokeScriptCommand

Is someone experiencing the same issues or has a hint how to resolve this for me?

Best regards,
zweailltienrger

I tried this in 2.1.0 myself and it seems to work on my end.

Can you try to navigate to this URL to see what is returned? It should be the JSON for the script you are trying to execute.

https://psuxchg.lkw-walter.com/api/v1/Script/set-mailboxrecipientlimit.ps1

Hi adam,

thanks for your reply. I tried with

Invoke-WebRequest -Uri https://psuxchg.lkw-walter.com/api/v1/Script/set-mailboxrecipientlimit.ps1 -Headers $Headers -Method Get

and in the Content section my script was shown as JSON. I’ll have to try this with 2.1.0, since yesterday I had to roll back to 1.5.16.

Best regards,
zweailltienrger

Hi adam,

I created a new instance with 2.1.0 and here’s the content for both:
1.5.16

{"id":1,"name":"whoami.ps1","description":null,"createdTime":"2021-07-02T07:27:20.6065105Z","manualTime":0.0,"timeOut":0.0,"commitId":null,"content":"whoami","scriptParameters":[],"identity":null,"tags":null,"status":0,"folder":null,"fullPath":"whoami.ps1","requiredPowerShellVersion":null,"environment":null,"errorAction":0,"informationAction":2,"verbose":false,"debug":false,"commitNotes":null,"disableManualInvocation":false,"maxHistory":100,"concurrentJobs":100,"credential":null}

2.1.0

<!doctype html><html lang="en"><head><base href="/login/"><meta charset="utf-8"/><link rel="icon" href="/login/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><meta name="description" content="Web site created using create-react-app"/><title>PowerShell Universal</title><link rel="apple-touch-icon" href="/login/logo.png"/><link rel="manifest" href="/login/manifest.json"/><title>React App</title><link href="/login/static/css/main.d27a7bc0.chunk.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div><script>!function(e){function r(r){for(var n,i,a=r[0],c=r[1],l=r[2],s=0,p=[];s<a.length;s++)i=a[s],Object.prototype.hasOwnProperty.call(o,i)&&o[i]&&p.push(o[i][0]),o[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(f&&f(r);p.length;)p.shift()();return u.push.apply(u,l||[]),t()}function t(){for(var e,r=0;r<u.length;r++){for(var t=u[r],n=!0,a=1;a<t.length;a++){var c=t[a];0!==o[c]&&(n=!1)}n&&(u.splice(r--,1),e=i(i.s=t[0]))}return e}var n={},o={1:0},u=[];function i(r){if(n[r])return n[r].exports;var t=n[r]={i:r,l:!1,exports:{}};return e[r].call(t.exports,t,t.exports,i),t.l=!0,t.exports}i.e=function(e){var r=[],t=o[e];if(0!==t)if(t)r.push(t[2]);else{var n=new Promise((function(r,n){t=o[e]=[r,n]}));r.push(t[2]=n);var u,a=document.createElement("script");a.charset="utf-8",a.timeout=120,i.nc&&a.setAttribute("nonce",i.nc),a.src=function(e){return i.p+"static/js/"+({}[e]||e)+"."+{3:"53d78046"}[e]+".chunk.js"}(e);var c=new Error;u=function(r){a.onerror=a.onload=null,clearTimeout(l);var t=o[e];if(0!==t){if(t){var n=r&&("load"===r.type?"missing":r.type),u=r&&r.target&&r.target.src;c.message="Loading chunk "+e+" failed.\n("+n+": "+u+")",c.name="ChunkLoadError",c.type=n,c.request=u,t[1](c)}o[e]=void 0}};var l=setTimeout((function(){u({type:"timeout",target:a})}),12e4);a.onerror=a.onload=u,document.head.appendChild(a)}return Promise.all(r)},i.m=e,i.c=n,i.d=function(e,r,t){i.o(e,r)||Object.defineProperty(e,r,{enumerable:!0,get:t})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,r){if(1&r&&(e=i(e)),8&r)return e;if(4&r&&"object"==typeof e&&e&&e.__esModule)return e;var t=Object.create(null);if(i.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:e}),2&r&&"string"!=typeof e)for(var n in e)i.d(t,n,function(r){return e[r]}.bind(null,n));return t},i.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(r,"a",r),r},i.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},i.p="/login/",i.oe=function(e){throw console.error(e),e};var a=this["webpackJsonplogin.v2"]=this["webpackJsonplogin.v2"]||[],c=a.push.bind(a);a.push=r,a=a.slice();for(var l=0;l<a.length;l++)r(a[l]);var f=c;t()}([])</script><script src="/login/static/js/2.e80116c8.chunk.js"></script><script src="/login/static/js/main.92142db4.chunk.js"></script></body></html>

Looks to me like the authentication isn’t working? I tried with a new created AppToken as well but no luck. Is the authorization still
@{ Authorization = 'Bearer <Token>'
?

Best regards,
zweailltienrger

Yes, it does look like authentication is failing and that format should still work.

What roles does the app token have? Administrator?

Hi adam,

the app token has the Execute role. I tried now with new tokens, using Administrator, Reader and Operator role and that worked. I got the Execute role from documentation for 1.5.x and it seems that global Access Control has been migrated to 2.x only for Administrator, Reader and Operator but not Execute?

Best regards,
zweailltienrger

This is a bug with the execute role. It will be resolved in 2.1.2.

Thank you very much.

Best regards,
zweailltienrger

2.1.2 is out and has this fix.

Hi adam,

thanks again, I can confirm this is working now. I marked your answer as solution to this issue.

Best regards,
zweailltienrger