Forge Home

ps1h

PS1 Helper files used by assorted custom Puppet modules.

462 downloads

45 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.8 (latest)
  • 0.1.6
  • 0.1.5
  • 0.1.4
  • 0.1.3
  • 0.1.2
  • 0.1.1
released Apr 22nd 2024
This version is compatible with:
  • Puppet Enterprise 2023.6.x, 2023.5.x, 2023.4.x, 2023.3.x, 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
  • Puppet >= 6.21.0 < 99.0.0

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'rfbennett-ps1h', '0.1.8'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add rfbennett-ps1h
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install rfbennett-ps1h --version 0.1.8

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

rfbennett/ps1h — version 0.1.8 Apr 22nd 2024

PS1 Helpers

PS1 Helper files used by assorted custom Puppet modules for use with Microsoft Windows.

Table of Contents

  1. Description
  2. Usage - Configuration options and additional functionality
  3. Limitations - OS compatibility, etc.
  4. Development - Guide for contributing to the module

Description

This module assists with centralizing certain PowerShell functions that are utilized by other Windows-based Puppet modules. It removes the need to maintain the exact same code within multiple locations/modules.

Usage

To use this module you simply need to 'Contain' or 'Include' it.
Review the included templates for examples on how to consume the PS1 files
An example of leveraging PowerShell .EPP templates:

  $log_output = true
  $some_other_param = 'C:\\Windows\\notepad.exe'
  $account_password = Sensitive('MockupOfAnEYAMLClassParameter')
  $epp_param_hash = {
    'account_name' => '.\\name_that_gets_passed_in_directly',
  }
  if ($account_password.unwrap != '') {
    exec { "Executing an example PS1 template for ${module_name}":
      provider  => powershell,
      command   => epp("${module_name}/_example_command.ps1.epp", $epp_param_hash),
      onlyif    => epp("${module_name}/_example_onlyif.ps1.epp", $epp_param_hash),
      logoutput => $log_output,
    }
  }

Remember, you can wrap the entire command within Sensitive if you need to reduce potential leaks:
command => Sensitive(epp("${module_name}/_example_command.ps1.epp", $epp_param_hash)), onlyif => Sensitive(epp("${module_name}/_example_onlyif.ps1.epp", $epp_param_hash)),

To force log output, create a SYSTEM environment variable named 'PUPPET_PS_HELPER_DEBUG' and set its value to 'True'.

Limitations

  1. This modules uses the following to generate the contents of the REFERENCE.md file:
  • puppet strings generate --format markdown --out REFERENCE.md
  1. This module has been evaluated against the following (as determined using $PSVersionTable):
  • Microsoft Windows Server 2022 (running PowerShell 5.1.20348.2227)
  • Microsoft Windows Server 2019 (running PowerShell 5.1.17763.5458)
  • Microsoft Windows Server 2016 (running PowerShell 5.1.14393.6343)
  • Microsoft Windows 11 (running PowerShell 5.1.22621.2506)

Development

Feedback and ideas are always welcome - please contact an Author (listed in metadata.json) to discuss your input, or feel free to simply open an Issue.

Command to apply this module locally (and try it out):
puppet apply --modulepath="<PathToModuleParentFolders>" --execute "include <ModuleName>" --environment "<EnvironmentName>" --no-splay --verbose --debug

For example: puppet apply --modulepath="C:\ProgramData\PuppetLabs\code\environments\production\modules;c:\projects\forge" --execute "include ps1h" --environment "production" --no-splay