{"id":22574406,"url":"https://github.com/kirkmunro/snippetpx","last_synced_at":"2026-03-02T08:02:19.857Z","repository":{"id":21341172,"uuid":"24658133","full_name":"KirkMunro/SnippetPx","owner":"KirkMunro","description":"Invocable Snippet Support in PowerShell","archived":false,"fork":false,"pushed_at":"2018-04-10T12:27:37.000Z","size":427,"stargazers_count":45,"open_issues_count":2,"forks_count":6,"subscribers_count":10,"default_branch":"master","last_synced_at":"2025-07-21T05:42:25.863Z","etag":null,"topics":["module","powershell","powershell-modules"],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KirkMunro.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}},"created_at":"2014-09-30T22:32:25.000Z","updated_at":"2024-06-21T16:38:41.000Z","dependencies_parsed_at":"2022-08-20T23:00:56.216Z","dependency_job_id":null,"html_url":"https://github.com/KirkMunro/SnippetPx","commit_stats":null,"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"purl":"pkg:github/KirkMunro/SnippetPx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KirkMunro%2FSnippetPx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KirkMunro%2FSnippetPx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KirkMunro%2FSnippetPx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KirkMunro%2FSnippetPx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KirkMunro","download_url":"https://codeload.github.com/KirkMunro/SnippetPx/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KirkMunro%2FSnippetPx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29995910,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-02T01:47:34.672Z","status":"online","status_checked_at":"2026-03-02T02:00:07.342Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["module","powershell","powershell-modules"],"created_at":"2024-12-08T03:05:51.867Z","updated_at":"2026-03-02T08:02:14.843Z","avatar_url":"https://github.com/KirkMunro.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿## SnippetPx\n\n### Overview\n\nThe SnippetPx module enhances the snippet experience in PowerShell by offering\na new format for Snippets: plain, ordinary ps1 files. These snippets are not\njust blocks of script that could be injected into a file. They are also\ninvocable! This enables better reuse of commonly used pieces of script that\nwould not otherwise be placed into a PowerShell function, either because the\nfunction support in PowerShell won't allow for it to be invoked properly in\nthe current scope, or because it isn't big enough to warrant adding another\nfunction to the function pool.\n\nSnippets are automatically discovered based on their inclusion in the following\nfolders (in the order in which they are listed):\n- the current user snippets folder (Documents\\WindowsPowerShell\\snippets);\n- the all users snippets folder (Program Files\\WindowsPowerShell\\snippets);\n- the snippets folder in the SnippetPx module (SnippetPx\\snippets);\n- the snippets folder in all other modules, in the order in which they are\ndiscovered according to the PSModulePath environment variable;\n\nIf multiple snippets with the same name exist in different folders, only the\nfirst snippet with that name will be discovered. To guarantee uniqueness of\nsnippets across modules, snippets specific to a module should use a snippet name\nprefixed with the module name. For example, a snippet to provision AD users in an\nActiveDirectory module could use the filename ActiveDirectory.User.Provision.ps1.\n\nUsing spaces in snippet filenames is supported, but discouraged.\n\nNot all snippets are appropriate for use in all situations. When in doubt, consult\nthe documentation for the snippet to ensure it is appropriate for your use case.\n\n### Minimum requirements\n\n- PowerShell 3.0\n\n### License and Copyright\n\nCopyright 2016 Kirk Munro\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\n### Installing the SnippetPx module\n\nYou can download and install the latest version of SnippetPx using any\nof the following methods:\n\n#### PowerShellGet\n\nIf you don't know what PowerShellGet is, it's the way of the future for PowerShell\npackage management. If you're curious to find out more, you should read this:\n\u003ca href=\"http://blogs.msdn.com/b/mvpawardprogram/archive/2014/10/06/package-management-for-powershell-modules-with-powershellget.aspx\" target=\"_blank\"\u003ePackage Management for PowerShell Modules with PowerShellGet\u003c/a\u003e\n\nNote that these commands require that you have the PowerShellGet module installed\non the system where they are invoked.\n\n```powershell\n# If you don’t have SnippetPx installed already and you want to install\n# it for all all users (recommended, requires elevation)\nInstall-Module SnippetPx\n\n# If you don't have SnippetPx installed already and you want to install\n# it for the current user only\nInstall-Module SnippetPx -Scope CurrentUser\n\n# If you have SnippetPx installed and you want to update it\nUpdate-Module\n```\n\n#### PowerShell 3.0 or Later\n\nTo install from PowerShell 3.0 or later, open a native PowerShell console (not ISE,\nunless you want it to take longer), and invoke one of the following commands:\n\n```powershell\n# If you want to install SnippetPx for all users or update a version already\n#  installed (recommended, requires elevation for new install for all users)\n\u0026 ([scriptblock]::Create((iwr -uri http://bit.ly/Install-ModuleFromGitHub).Content)) -ModuleName SnippetPx\n\n# If you want to install SnippetPx for the current user\n\u0026 ([scriptblock]::Create((iwr -uri http://bit.ly/Install-ModuleFromGitHub).Content)) -ModuleName SnippetPx -Scope CurrentUser\n```\n\n### Using the SnippetPx module\n\nTo see a list of all snippets that are available in your environment, invoke\nthe following command:\n\n```powershell\nGet-Snippet\n```\n\nThis will return a list of all snippets that have been discovered on the\nlocal system in the snippets folders that it found. Each snippet object will\ninclude the name of the snippet, the path to the snippet file, a synopsis\nidentifying what the snippet does, a description that describes the snippet\nin a little more detail, and a script block that contains the body of the\nsnippet.\n\nOnce you have identified a snippet that you want to invoke in one of your\nscripts, you can invoke that snippet with a command like the following:\n\n```powershell\n# Import all ps1 files in the functions folder into the current scope\nInvoke-Snippet -Name ScriptFile.Import -Parameters @{\n    Path = Join-Path -Path $PSModulePath -ChildPath functions\n}\n```\n\nSome snippets are included with the SnippetsPx module, and others may be\ndiscovered in other modules or in the current user or all user snippets\nfolders. It is important to note that invoking a snippet alone does not\nautomatically load the module in which it is contained. The module will\nonly be auto-loaded if the snippet itself contains a command that would\ntrigger the auto-loading of the module. This is worth understanding for\nmodules that include snippets that work with module content other than\ndiscoverable commands.\n\n### Command List\n\nThe SnippetPx module currently includes the following commands:\n\n```powershell\nGet-Snippet\nInvoke-Snippet\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirkmunro%2Fsnippetpx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkirkmunro%2Fsnippetpx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkirkmunro%2Fsnippetpx/lists"}