Symptoms
When deploying the K2 for SharePoint app through the offline installer downloaded from the K2 portal we get the following error message:
K2Application.InstallApp: 10:13:26:>> Logged Error: Could not install app. Exception: System.Management.Automation.RuntimeException: You cannot call a method on a null-valued expression.
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at SourceCode.SharePoint2013.Common.Powershell.Runscript(String scriptfile, Collection`1and errors, CommandParameterr] commandParemeters)
at SourceCode.SharePoint2013.Common.K2Application.InstallApp()
Diagnoses
Verified Internet explorer proxy settings and ran the registration Wizard using a Tenant Admin Account.
Resolution
We made changes to the proxy settings in the IE browser to not automatically detect settings.
The K2 app was then successfully registered from the K2 server with a global tenant account, not the k2 Service account as per our documentation.
https://help.k2.com/onlinehelp/K2ForSharePoint/ICG/4.6.11/default.htm_Install_Topics/OnPrem/Add_App.htm
"The first time you run the registration wizard on any Site Collection, you must run it with an identity that is a Tenant Admin (subsequent installations require Site Collection Administration rights), not doing so causes the Registration wizard to fail when uploading the K2 for SharePoint App."