{"id":14063534,"url":"https://github.com/mkht/pspm","last_synced_at":"2025-07-23T03:05:57.326Z","repository":{"id":113257708,"uuid":"134438775","full_name":"mkht/pspm","owner":"mkht","description":"PowerShell Package Manager","archived":false,"fork":false,"pushed_at":"2023-12-26T15:25:50.000Z","size":270,"stargazers_count":13,"open_issues_count":8,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-06T08:42:04.742Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mkht.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2018-05-22T15:49:54.000Z","updated_at":"2024-05-08T08:42:36.000Z","dependencies_parsed_at":"2024-02-04T20:27:24.253Z","dependency_job_id":"a81c155f-1199-450c-a484-f88a9388b098","html_url":"https://github.com/mkht/pspm","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/mkht/pspm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2Fpspm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2Fpspm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2Fpspm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2Fpspm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mkht","download_url":"https://codeload.github.com/mkht/pspm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mkht%2Fpspm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266609067,"owners_count":23955569,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-13T07:03:23.176Z","updated_at":"2025-07-23T03:05:57.305Z","avatar_url":"https://github.com/mkht.png","language":"PowerShell","funding_links":[],"categories":["PowerShell"],"sub_categories":[],"readme":"# pspm - PowerShell Package Manager\n\npspm is the management tools for PowerShell modules.  \nYou can manage PowerShell modules [npm](https://www.npmjs.com/) like commands.\n\n\n----\n## Requirements\n\n+ Windows PowerShell 5.1 or higher\n+ PowerShell Core 6.0 or higher\n+ Windows or macOS\n\n\u003e Testing platforms:  \n\u003e Windows 11 Pro x64 22H2 with PowerShell 5.1 \u0026 PowerShell 7.3.1  \n\u003e macOS Monterey 12.6 with PowerShell 7.3.1\n\n----\n## Installation\n\nYou can install pspm from [PowerShell Gallery](https://www.powershellgallery.com/packages/pspm/).\n```Powershell\nInstall-Module -Name pspm\n```\n\n#### Option: Update PowerShellGet\nWe strongly recommend using the latest PowerShellGet module to improve compatibility and stability.  \nTo update PowerShellGet use the following command and restart PowerShell.  \n\n```PowerShell\nInstall-Module PowerShellGet -Force -AllowClobber\n```\n\n----\n## Usage\n\n### Install \u0026 Import Modules\n\nThe command `pspm install` will download a module from [PSGallery](https://www.powershellgallery.com/).  \n\n```PowerShell\npspm install '\u003cModule Name\u003e'\n```\n\nThis will create the `Modules` folder in the current directory and will download the module to that folder, then import it to the current PS session.\n\n#### Tips: Specify the Module version\n\nIf you want to install specific version of the Module.  \nYou can specify the Module name with version or [semver](https://docs.npmjs.com/misc/semver#ranges) range syntax.  \n\n```PowerShell\npspm install '\u003cModule Name\u003e@\u003cVersion\u003e'  # e.g) pspm install 'Pester@4.1.0'\n```\n\n#### Tips: Specify the repository\n\nIf you want to install the module from specific repository (like Private repository)  \nYou can specify the PSRepository name.  \n(You should register repositories before. See [Microsoft docs](https://docs.microsoft.com/en-us/powershell/module/powershellget/register-psrepository?view=powershell-7))\n\n```PowerShell\npspm install '@\u003cRepository Name\u003e/\u003cModule Name\u003e'  # e.g) pspm install '@PrivateRepo/MyModule'\n```\n\n\n#### Tips: Get modules from GitHub :octocat:\n\nYou can download modules from GitHub repos.  \nJust `\u003cuser\u003e/\u003crepo-name\u003e` or `\u003cuser\u003e/\u003crepo-name\u003e#\u003cref\u003e`, or `\u003cuser\u003e/\u003crepo-name\u003e#\u003cref\u003e::path/to/subdir`.  \n`\u003cref\u003e` as `branch` or `commit-hash` or `Tag`  \n\n```PowerShell\npspm install '\u003cuser\u003e/\u003crepo-name\u003e'\npspm install '\u003cuser\u003e/\u003crepo-name\u003e#\u003cref\u003e'\npspm install '\u003cuser\u003e/\u003crepo-name\u003e#\u003cref\u003e::path/to/subdir'\n# e.g) pspm install 'pester/Pester#7aa9e63'\n```\n\nYou can specify `Credential` or `GitHubToken` If you want to get modules from **private** repos.  \nAlso, if an environment variable `GITHUB_TOKEN` is present, pspm uses it as GitHub Personal Access Token.  \n(Priority: `Credential` \u003e `GitHubToken` \u003e `GITHUB_TOKEN`)\n\n```PowerShell\n# Authenticate with Credential (username \u0026 password)\npspm install '\u003cuser\u003e/\u003cprivate-repo-name\u003e' -Credential (Get-Credential)\n\n# Authenticate with Personal Access Token\n# You should convert token to [SecureString]\n$SecureToken = ConvertTo-SecureString '\u003cplain-token\u003e' -AsPlainText -Force\npspm install '\u003cuser\u003e/\u003cprivate-repo-name\u003e' -GitHubToken $SecureToken\n```\n\n\n#### Tips: Install multiple Modules at once\n\nIf you want to install multiple modules at once or manage modules as code.  \nYou can create `package.json` and run the `pspm install` without module name.  \n\nIf there is a `package.json` file in the working directory, pspm installs all modules in the list.  \n\nAbout `package.json`, please refer [the section](#packagejson) below.\n\n\n#### Option: Global installation\n\nInstall a module as global.  \nModule will save to the `$env:ProgramFiles\\WindowsPowerShell\\Modules` (on Windows)\n\n```PowerShell\npspm install '\u003cModule Name\u003e' -Global\npspm install '\u003cModule Name\u003e' -g\npspm install '\u003cModule Name\u003e' -Scope Global\n```\n\n#### Option: User installation\n\nInstall a module to current user profile.  \nModule will save to the `$env:UserProfile\\WindowsPowerShell\\Modules` (on Windows)\n\n```PowerShell\npspm install '\u003cModule Name\u003e' -Scope CurrentUser\n```\n\n\n#### Option: Clean installation\n\nWhen `-Clean` switch specified, pspm will remove **ALL modules** in the `Modules` folder before install process.  \n\n```PowerShell\npspm install '\u003cModule Name\u003e' -Clean\n# WARNING: -Clean option will remove all modules in the Modules folder, NOT just the specified.\n```\n\n\n#### Option: Disable modules import\n\n`pspm install` will import modules automatically after install.  \nIf you don't like this behavior, Specify `-NoImport` switch. \n\n```PowerShell\npspm install '\u003cModule Name\u003e' -NoImport\n```\n\n----\n### Update Modules\n\nThe command `pspm update` will update modules.  \n\n```PowerShell\npspm update '\u003cModule Name\u003e'   # specify the name of module\npspm update  # with package.json\n```\n\n**NOTICE:** The `pspm update` will change `package.json` to save the new version as the minimum required dependency. If you don't wanna update, use `pspm update -Save:$false`\n\n\n#### Tips: What's the difference between install and update ?\n\nThought as below scenarios.  \n+ The module `Example@1.0.0` is installed in the system.  \n+ Latest version of `Example` is `1.2.0`.\n\nIn this scenario. If you run the command `pspm install 'Example@1.x'`, pspm will NOT update the module that because `1.0.0` is satisfied `1.x`.  \nBut if you run `pspm update 'Example@1.x'`, pspm will update the `Example` to `1.2.0`.  \n\n\n----\n### Uninstall Modules\n\nTo remove a module from your `Modules` folder, use:\n\n```PowerShell\npspm uninstall '\u003cModule Name\u003e'\n```\n\n----\n### Run scripts\n\npspm supports the `\"scripts\"` property of the `package.json`.  \n\n```PowerShell\npspm run '\u003cScript Name\u003e'\npspm run '\u003cScript Name\u003e' -Arguments [Object[]]  #with arguments\npspm run '\u003cScript Name\u003e' -IfPresent  #run only when the scripts exist\n#aliases: pspm run-script\n```\n\n\n### Special terms\n\nYou can omit `run` when running a script with some special words. (`start`, `restart`, `stop`, `test`)\n\n```PowerShell\npspm start    # = pspm run start\npspm restart  # = pspm run restart\npspm stop     # = pspm run stop\npspm test     # = pspm run test\n```\n\n\n#### Example\n\nSave `package.json` that has `scripts` property like below in the working directory.  \n\n```json\n\"scripts\": {\"hello\": \"echo 'Hello pspm !'\"}\n```\n\nTo run `Hello` script, exec the command.\n\n```PowerShell\nPS\u003e pspm run 'hello'\nHello pspm !\n```\n\n\n#### Tips: Use Arguments\n\nYou can use custom arguments when executing scripts.\n\n```json\n\"scripts\": {\"name\": \"echo 'Your name is $args[0]'\"}\n```\n```PowerShell\nPS\u003e pspm run 'name' -Arguments 'MyName'\nYour name is MyName\n```\n\n\n#### Tips: Use \"config\" object\n\nThe `package.json` that has \"config\" keys. You can use the object as environment variable of `pspm_package_config_\u003ckey\u003e`\n\n```json\n\"scripts\": {\"show_port\": \"echo \\\"Port: $env:pspm_package_config_port\\\"\"},\n\"config\" : {\"port\": \"8080\"}\n```\n```PowerShell\nPS\u003e pspm run 'show_port'\nPort: 8080\n```\n\n\n#### Tips: Invoke script file\n\nYou can invoke outer PowerShell script file.\n\n```json\n\"scripts\": {\"ps1\": \".\\\\script.ps1\"},\n```\n\n\n----\n### Hook scripts\n\nIf you want to run a specific script at a specific timing, then you can use a hook script.\n\n+ **install** hook\n  - **preinstall**: Run BEFORE `pspm install`\n  - **install**, **postinstall**: Run AFTER `pspm install`\n\n+ **update** hook\n  - **preupdate**: Run BEFORE `pspm update`\n  - **update**, **postupdate**: Run AFTER `pspm update`\n\n+ **uninstall** hook\n  - **preuninstall**, **uninstall**: Run BEFORE `pspm uninstall`\n  - **postuninstall**: Run AFTER `pspm uninstall`\n\n+ Specific script hook\n  - **prestart**, **poststart**: Run by the `pspm start`\n  - **prerestart**, **postrestart**: Run by the `pspm restart`\n  - **prestop**, **poststop**: Run by the `pspm stop`\n  - **pretest**, **posttest**: Run by the `pspm test`\n\n+ User-defined script hook\n  - **pre\\\u003cname\\\u003e**, **post\\\u003cname\\\u003e**: Run by the `pspm run \u003cname\u003e`\n\n\n#### Example\n\n```json\n\"scripts\": {\n  \"preinstall\": \"echo '(preinstall) run before install'\",\n  \"install\": \"echo '(install) run after install'\",\n  \"postinstall\": \"echo '(postinstall) run after install'\"\n  }\n```\n\n```PowerShell\nPS\u003e pspm install 'Pester@4.2.0'\n(preinstall) run before install\nPester@4.2.0: Downloading module.\nPester@4.2.0: Importing module.\n(install) run after install\n(postinstall) run after install\n```\n\n----\n## package.json\n\nA package.json file:\n\n+ lists the modules that your project depends on.\n+ allows you to specify the versions of a module that you want to use.\n+ define scripts for CI/CD process.\n\n\n### scripts\n\nYou can define script in package.json  \nPlease refer [run scripts](#run-scripts)  \n\n```json\n\"scripts\": {\"hello\": \"echo 'Hello pspm !'\"}\n```\n\n### config\n\ndefine environment variable for run-scripts.  \nPlease refer [run scripts](#run-scripts) \n\n```json\n\"config\": {\"port\": \"8080\"}\n```\n\n### dependencies\n\nTo specify the modules your project depends on, you need to list the modules you'd like to use in your package.json file.  \n\n```javascript\n  \"dependencies\": {\n    \"\u003cModule name 1\u003e\": \"\u003cVersion\u003e\",\n    \"\u003cModule name 2\u003e\": \"\u003cVersion\u003e\"\n  }\n```\n\n#### Specifying Module Versions\n\nYou can use [npm-semver](https://docs.npmjs.com/misc/semver#ranges) syntax for specifying versions.  \n\n+ **Exact**\n  - *version* Must match version exactly.  `\"1.2.0\"`\n  - A leading `\"=\"` or `\"v\"` is ignored.  `\"v1.2.3\" == \"1.2.3\"`\n\n+ **Any**\n  - `\"*\"` (asterisk) or `\"\"` (empty) Any versions accepted.\n\n+ **Latest**\n  - `\"latest\"` Match only newest version\n\n+ **Comparators**\n  - *\u003c*, *\u003e*, *\u003c=*, *\u003e=* Less than, Greater than, Less equal, Greater equal `\u003e=1.0.0`\n\n+ **Hyphen Ranges**\n  - *X.Y.Z - A.B.C* specifies an inclusive set.  `1.2.3 - 2.3.4 := \u003e=1.2.3 \u003c=2.3.4`\n\n+ **X-Ranges**\n  - `1.x := \u003e=1.0.0 \u003c2.0.0`\n  - A partial version range is treated as an X-Range  `2.3 := 2.3.x := \u003e=2.3.0 \u003c2.4.0`\n\n+ **Caret Ranges**\n  - Allows changes that do not modify the left-most non-zero digit.\n  - `^1.2.3 := \u003e=1.2.3 \u003c2.0.0`\n  - `^0.0.3 := \u003e=0.0.3 \u003c0.0.4`\n\n+ **Tilde Ranges**\n  - `~1.2.3 := \u003e=1.2.3 \u003c1.3.0`\n  - The rule of tilde range is bit complicated. Please refer [npm-docs](https://docs.npmjs.com/misc/semver#tilde-ranges-123-12-1).\n\n\n### Example\n\nThis is valid `package.json` sample.\n```json\n{\n  \"scripts\": {\n    \"hello\": \"echo 'hello pspm'\",\n    \"show_port\": \"echo \\\"Port: $env:pspm_package_config_port\\\"\"\n  },\n  \"config\": {\"port\": \"8080\"},\n  \"dependencies\": {\n    \"Pester\": \"4.x\",\n    \"AWSPowerShell\": \"3.3.283.0\",\n    \"PSSlack\": \"\u003e=0.1.0\"\n  }\n}\n```\n\n\n----\n## Change log\n+ **1.8.0**\n  - Fix minor issues in the PowerShell 7.4 environment.\n\n+ **1.7.1**\n  - **NEW**: Add new syntax `pspm install \u003cuser\u003e/\u003crepo-name\u003e#\u003cref\u003e::path/to/subdir` for fetching subdirectories within github repos.\n  - Change minimum supported version of PowerShell to 5.1\n\n+ **1.6.3**\n  - Fixed issue in error handling when downloading modules from GitHub in PowerShell 7.\n\n+ **1.6.2**\n  - Fixed issue that the prerelease version of the module does not handling property.\n\n+ **1.6.1**\n  - Fixed issue that a \"null\" file being saved in the current directory.\n  - Pin Pester module to 4.x because Pester 5.x is currently not compatible.\n\n+ **1.6.0**\n  - Enable TLS 1.2 when loading the module (if not supported)  \n    This is in preparation for a [change in TLS support](https://devblogs.microsoft.com/powershell/powershell-gallery-tls-support/) in the PowerShell Gallery\n  - Fix some potential issues in the internal function `Format-Json` (Thanks @vody!)\n\n+ **1.5.1**\n  - Improved stability when using an older version of PowerShellGet.  \n    (We recommend that you continue to update the latest PowerShellGet for the best experience.)  \n\n+ **1.5.0**\n  - Add new syntax `pspm install @\u003cRepo\u003e/\u003cName\u003e` for get modules from specific repository.\n\n+ **1.4.5**\n  - Fixed issue that an error occurs when the `pspm install` command was executed simultaneously in multiple processes.\n  \n+ **1.4.4**\n  - Fixed issue that GitHub credential params are not used when downloading modules using `package.json` [#72](https://github.com/mkht/pspm/issues/72)\n\n+ **1.4.3**\n  - Improve verbose messages.\n\n+ **1.4.2**\n  - Fixed issue that an environment variable `GITHUB_TOKEN` is not working properly.\n  - Improve help messages.\n\n+ **1.4.1**\n  - Fixed an issue that an error occurs when acquiring a module if invalid folders or files exists in the Modules folder  [#71](https://github.com/mkht/pspm/issues/71)\n\n+ **1.4.0**\n  - If an environment variable `GITHUB_TOKEN` is present, pspm uses it as GitHub PAT\n  - Exceptions at installing modules has been changed to non-terminating error\n  - Improved error messages\n\n+ **1.3.0**\n  - Fixed issue that failed to download module from GitHub in macOS [#66](https://github.com/mkht/pspm/issues/66)\n  - Download from GitHub private repository [#12](https://github.com/mkht/pspm/issues/12)\n  - When acquiring a module from GitHub, pspm will skip download if a module already exists.\n  - Added `-NoImport` switch in `pspm install` \u0026 `pspm update` [#60](https://github.com/mkht/pspm/issues/60)\n  - Fix PSSA issues\n\n+ **1.2.3**\n  - Fixed issue that an older version of module has been installed unexpectedly on some environments. [#62](https://github.com/mkht/pspm/issues/62)\n  - The pre-release tag comparison process was improved to be equal to [npm-semver](https://docs.npmjs.com/misc/semver#prerelease-tags) [#46](https://github.com/mkht/pspm/issues/46) [#47](https://github.com/mkht/pspm/issues/47)\n\n+ **1.2.1**\n  - **Fixed critical issue** that `pspm install` does not function properly in PowerShellGet 1.6+.\n\n+ **1.2.0 (deprecated)**\n  - Now warning message displayed when loading modules if your system uses older version of PowerShellGet.\n  - Fixed issue that some modules that has pre-release versions fails to install in PowerShell 5.1 and earlier systems. [#61](https://github.com/mkht/pspm/issues/61)\n  - Some compatibility improvement\n\n+ **1.1.3**\n  - Fixed issue that some modules that has dependencies fails to import. [#59](https://github.com/mkht/pspm/issues/59)\n\n+ **1.1.2**\n  - Some compatibility improvement\n  - Suppress unneeded output when Module folder created\n\n+ **1.1.0**\n  - You can pass any type of objects to `pspm run` arguments\n\n+ **1.0.0**\n  - Initial public release\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkht%2Fpspm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkht%2Fpspm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkht%2Fpspm/lists"}