1

I am trying to use package manager to install our packages. Those are .msi files and not Nuget Or Chocolatey Packages.

I stored them on a share drive we have.

Localy, everything run great. I run:

Install-package "\\nameofserver\share\program.msi"

However, when I try remotely like this:

Invoke-Command -ComputerName $computer -credential $cred -Scriptblock {Install-Package "\\nameofserver\share\program.msi"}

I get this error (it's in french so I'll translate):

No match was found for the specified search criteria and package name \servername\share\program.msi

Use get-packagesources to find all packages sources available.

I don't have a package provider... it is a MSI file! Got any idea how to make this work?

I tried trying to include providername. Didn't work. I don't get why it works locally but NOT using invoke-command....

*** edit here is the code that works:

Invoke-Command -ComputerName $Computer -Credential $Cred -ScriptBlock {$null = New-PSDrive -Credential $using:Cred deploywin -Root (Split-Path -Parent $using:SharePath) -PSProvider FileSystem Install-Package '\servername\share\MSI\node-v11.13.0-x64.msi'}

Axiom
  • 33
  • 1
  • 8
  • I think you'll find a solution in the linked post; let us know if you don't. What muddied the waters in your case is that the inability to access the _UNC share_ was treated the same as a failure to find a package _online_. – mklement0 Apr 08 '19 at 21:25
  • Huuummm not sure it is the same problem so I don't think it is a duplicate. I already use a variable containing my credentials ($cred). I'll try the new-psdrive method but i'm not optimist. – Axiom Apr 09 '19 at 00:32
  • It is not the same problem. – Axiom Apr 09 '19 at 00:32
  • Providing credentials to `Invoke-Command` directly is not enough; you must use the same credentials _in the remote session_ via `$using:cred` to connect to the share _from there_. – mklement0 Apr 09 '19 at 00:37
  • ahhh thanks for the explanation. I'll give it a shot and report back! – Axiom Apr 09 '19 at 12:15
  • 1
    Well what do you know it works! I stand humbled. – Axiom Apr 09 '19 at 13:02

0 Answers0