Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


powershell (39) Versions 1.1.0

Installs/Configures PowerShell on the Windows platform

cookbook 'powershell', '= 1.1.0', :supermarket
cookbook 'powershell', '= 1.1.0'
knife supermarket install powershell
knife supermarket download powershell
Quality -%


Installs and configures PowerShell 2.0. Also includes a resource/provider for
executing scripts using the PowerShell interpreter.



  • Windows XP
  • Windows Server 2003 (R1, R2)
  • Windows Vista
  • Windows 7
  • Windows Server 2008 (R1, R2)




Execute a script using the powershell interpreter (much like the script resources
for bash, csh, perl, python and ruby). A temporary file is created and executed
like other script resources, rather than run inline. By their nature, Script
resources are not idempotent, as they are completely up to the user's imagination.
Use the not_if or only_if meta parameters to guard the resource for idempotence.


  • :run: run the script

Attribute Parameters

  • command: name attribute. Name of the command to execute.
  • code: quoted string of code to execute.
  • creates: a file this command creates - if the file exists, the command will not be run.
  • cwd: current working directory to run the command from.
  • flags: command line flags to pass to the interpreter when invoking.
  • environment: A hash of environment variables to set before running this command.
  • user: A user name or user ID that we should change to before running this command.
  • group: A group name or group ID that we should change to before running this command.
  • returns: The return value of the command (may be an array of accepted values) - this resource raises an exception if the return value(s) do not match.
  • timeout: How many seconds to let the command run before timing it out.


# change the computer's hostname
powershell "rename hostname" do
  code < 'BAZ'})
  code <



Mixin to execute powershell commands during compile time. Most useful if needing powershell to drive LWRP behavior


  • script: The powershell code to execute
  • options: The options hash to drive execution behavior. Same options available as in shell_out, with the addition of :architecture, which allows you to override the default architecture. Essentially allows you to run 32-bit powershell in 64-bit windows.


The following illustrates using options to require 32-bit AND run as a different user

# check if a user is a member of local admins
:include Chef::Mixin::PowershellOut
script =<



Include the default recipe in a run list, to ensure PowerShell 2.0 is installed.

On the following versions of Windows the PowerShell 2.0 package will be
downloaded from Microsoft and installed:

  • Windows XP
  • Windows Server 2003
  • Windows Server 2008 R1
  • Windows Vista

On the following versions of Windows, PowerShell 2.0 is present and must just be

  • Windows 7
  • Windows Server 2008 R2
  • Windows Server 2008 R2 Core

PLEASE NOTE - The installation may require a restart of the node being
configured before PowerShell (or the powershell script resource) can be used
(yeah Windows!).

License and Author

Author:: Seth Chisamore (

Copyright:: 2011-2012, Opscode, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

No quality metric results found