locked
PowerShell v5 Install-Script? RRS feed

  • Question

  • I am researching the Install-Script cmdlet in v5 as a possible improvement to a script distribution scheme. Toward that end I have created a local PSRepository and successfully published a script to that repository. When I look in the network share for the repository I can see a .Nupkg file corresponding to my successfully published script. I can also enumerate the published script in the repository with Find-Script.

    Now, what can I do with it? I've executed Install-Script, specifying the repository, but have so far been unable to decipher the syntax to execute this installed script. I am assuming I should be able to execute it after installing it...

    I am able to run Save-Script to retrieve the script from the repository and have validated that the script it intact and valid.

    My searches have not revealed the error of my ways on this one. I suspect I've misunderstood something in this short chain so please illuminate me.

    TIA

    Friday, November 9, 2018 10:36 PM

Answers

  • Solved...somewhat.

    Apparently Install-Script drops, at least in my case, the published script into my "C:\Program Files\WindowsPowerShell\Scripts" folder. Since this is not in my PATH or PSModulePath I did not locate it initially.

    • Marked as answer by Rene Nielsen Friday, November 9, 2018 10:58 PM
    Friday, November 9, 2018 10:58 PM

All replies

  • Solved...somewhat.

    Apparently Install-Script drops, at least in my case, the published script into my "C:\Program Files\WindowsPowerShell\Scripts" folder. Since this is not in my PATH or PSModulePath I did not locate it initially.

    • Marked as answer by Rene Nielsen Friday, November 9, 2018 10:58 PM
    Friday, November 9, 2018 10:58 PM
  • My conclusion is that the Install-Script cmdlet placed the downloaded and unpacked script into a "Scripts" subfolder under the first path in the PSModulePath system environment variable. I have not tested this definitively, just a conclusion based on the perfunctory evidence.

    Note that since the above mentioned "Scripts" subfolder is not directly referenced in an executable path it effectively goes into oblivion until you can find it. Unless my conclusions are incorrect, and I'll be the first to admit that's likely, the Install-Script cmdlet does not install the subject script into a referenceable location without some additional work. Hopefully someone can describe to me the process by which, barring additional manual steps, this can be useful as designed.

    Saturday, November 10, 2018 3:32 AM