{"id":14980481,"url":"https://github.com/puppetlabs/ruby-pwsh","last_synced_at":"2026-02-16T12:06:54.093Z","repository":{"id":38751775,"uuid":"206478739","full_name":"puppetlabs/ruby-pwsh","owner":"puppetlabs","description":"A ruby gem for interacting with PowerShell","archived":false,"fork":false,"pushed_at":"2024-10-28T01:09:40.000Z","size":691,"stargazers_count":15,"open_issues_count":12,"forks_count":23,"subscribers_count":72,"default_branch":"main","last_synced_at":"2024-10-29T17:21:20.193Z","etag":null,"topics":["hacktoberfest","module","powershell","ruby","supported"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/puppetlabs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-09-05T05:05:41.000Z","updated_at":"2024-10-25T10:39:36.000Z","dependencies_parsed_at":"2023-02-12T19:46:10.446Z","dependency_job_id":"7995ee7e-60f2-4899-b7a6-ddb85fbef3b9","html_url":"https://github.com/puppetlabs/ruby-pwsh","commit_stats":{"total_commits":296,"total_committers":26,"mean_commits":"11.384615384615385","dds":0.7567567567567568,"last_synced_commit":"a08de931335cbc3d53bf8c49a9c6c190094e5756"},"previous_names":[],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fruby-pwsh","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fruby-pwsh/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fruby-pwsh/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puppetlabs%2Fruby-pwsh/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puppetlabs","download_url":"https://codeload.github.com/puppetlabs/ruby-pwsh/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247217183,"owners_count":20903009,"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","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":["hacktoberfest","module","powershell","ruby","supported"],"created_at":"2024-09-24T14:01:50.012Z","updated_at":"2026-02-16T12:06:49.074Z","avatar_url":"https://github.com/puppetlabs.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ruby-pwsh\n\n[![Code Owners](https://img.shields.io/badge/owners-DevX--team-blue)](https://github.com/puppetlabs/ruby-pwsh/blob/main/CODEOWNERS)\n[![ci](https://github.com/puppetlabs/ruby-pwsh/actions/workflows/ci.yml/badge.svg)](https://github.com/puppetlabs/ruby-pwsh/actions/workflows/ci.yml)\n![GitHub release (latest by date)](https://img.shields.io/github/v/release/puppetlabs/ruby-pwsh)\n\n\u003e _The PowerShell gem._\n\nThis gem enables you to execute PowerShell from within ruby without having to instantiate and tear down a PowerShell process for each command called.\nIt supports Windows PowerShell as well as PowerShell Core (and, soon, _just_ PowerShell) - if you're running *PowerShell v3+, this gem supports you.\n\nThe `Manager` class enables you to execute and interoperate with PowerShell from within ruby, leveraging the strengths of both languages as needed.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ruby-pwsh'\n```\n\nAnd then execute:\n\n```shell\nbundle install\n```\n\nOr install it yourself as:\n\n```shell\ngem install ruby-pwsh\n```\n\n## Usage\n\nInstantiating the manager can be done using some defaults:\n\n```ruby\n# Instantiate the manager for Windows PowerShell, using the default path and arguments\n# Note that this takes a few seconds to instantiate.\nposh = Pwsh::Manager.instance(Pwsh::Manager.powershell_path, Pwsh::Manager.powershell_args)\n# If you try to create another manager with the same arguments it will reuse the existing one.\nps = Pwsh::Manager.instance(Pwsh::Manager.powershell_path, Pwsh::Manager.powershell_args)\n# Note that this time the return is very fast.\n# We can also use the defaults for PowerShell Core, though these only work if PowerShell is\n# installed to the default paths - if it is installed anywhere else, you'll need to specify\n# the full path to the pwsh executable.\npwsh = Pwsh::Manager.instance(Pwsh::Manager.pwsh_path, Pwsh::Manager.pwsh_args)\n```\n\nExecution can be done with relatively little additional work - pass the command string you want executed:\n\n```ruby\n# Instantiate the Manager:\nposh = Pwsh::Manager.instance(Pwsh::Manager.powershell_path, Pwsh::Manager.powershell_args)\n# Pretty print the output of `$PSVersionTable` to validate the version of PowerShell running\n# Note that the output is a hash with a few different keys, including stdout.\npp(posh.execute('$PSVersionTable'))\n# Lets reduce the noise a little and retrieve just the version number:\n# Note: We cast to a string because PSVersion is actually a Version object.\npp(posh.execute('[String]$PSVersionTable.PSVersion'))\n# We could store this output to a ruby variable if we wanted, for further use:\nps_version = posh.execute('[String]$PSVersionTable.PSVersion')[:stdout].strip\npp(\"The PowerShell version of the currently running Manager is #{ps_version}\")\n```\n\n## Reference\n\nYou can find the full reference documentation online, [here](https://rubydoc.info/gems/ruby-pwsh).\n\n\u003c!-- ## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). --\u003e\n\n## Supported Operating Systems\n\nThe following platforms are supported:\n\n- Windows\n- CentOS\n- Debian\n- Fedora\n- OSX\n- RedHat\n- Ubuntu\n- AlmaLinux\n\n## Limitations\n\n- When PowerShell [Script Block Logging](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logging_windows?view=powershell-7.4#enabling-script-block-logging) is enabled, data marked as sensitive in your manifest may appear in these logs as plain text. It is **highly recommended**, by both Puppet and Microsoft, that you also enable [Protected Event Logging](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_logging_windows?view=powershell-7.4#protected-event-logging) alongside this to encrypt the logs to protect this information.\n\n## License\n\nThis codebase is licensed under Apache 2.0. However, the open source dependencies included in this codebase might be subject to other software licenses such as AGPL, GPL2.0, and MIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fruby-pwsh","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuppetlabs%2Fruby-pwsh","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuppetlabs%2Fruby-pwsh/lists"}