<commit_before>Description
===========

Provides a set of Windows-specific primitives (Chef resources) meant to aid in the creation of cookbooks/recipes targeting the Windows platform.

Requirements
============

Platform
--------

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

Cookbooks
---------

* chef_handler (`windows::reboot_handler` leverages the chef_handler LWRP)

Attributes
==========

* `node['windows']['allow_pending_reboots']` - used to configure the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) to act on pending reboots. default is true (ie act on pending reboots).  The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list.

Resource/Provider
=================

windows\_auto\_run
------------------

### Actions
- :create: Create an item to be run at login
- :remove: Remove an item that was previously setup to run at login

### Attribute Parameters
- :name: Name attribute. The name of the value to be stored in the registry
- :program: The program to be run at login
- :args: The arguments for the program

### Examples

  # Run BGInfo at login
  windows_auto_run 'BGINFO' do
    program "C:/Sysinternals/bginfo.exe"
    args "\"C:/Sysinternals/Config.bgi\" /NOLICPROMPT /TIMER:0"
    not_if { Registry.value_exists?(AUTO_RUN_KEY, 'BGINFO') }
    action :create
  end


windows\_batch
--------------
Execute a batch script using the cmd.exe interpreter (much like the script resources for bash, csh, powershell, 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.

### Actions

- :run: run the batch file

### 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.
- 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.

### Examples

    windows_batch "unzip_and_move_ruby" do
      code <<-EOH
      7z.exe x #{Chef::Config[:file_cache_path]}/ruby-1.8.7-p352-i386-mingw32.7z  -oC:\\source -r -y
      xcopy C:\\source\\ruby-1.8.7-p352-i386-mingw32 C:\\ruby /e /y
      EOH
    end

    windows_batch "echo some env vars" do
      code <<-EOH
      echo %TEMP%
      echo %SYSTEMDRIVE%
      echo %PATH%
      echo %WINDIR%
      EOH
    end


windows\_feature
----------------

Windows Roles and Features can be thought of as built-in operating system packages that ship with the OS.  A server role is a set of software programs that, when they are installed and properly configured, lets a computer perform a specific function for multiple users or other computers within a network.  A Role can have multiple Role Services that provide functionality to the Role.  Role services are software programs that provide the functionality of a role. Features are software programs that, although they are not directly parts of roles, can support or augment the functionality of one or more roles, or improve the functionality of the server, regardless of which roles are installed.  Collectively we refer to all of these attributes as 'features'.

This resource allows you to manage these 'features' in an unattended, idempotent way.

There are two providers for the `windows_features` which map into Microsoft's two major tools for managing roles/features: [Deployment Image Servicing and Management (DISM)](http://msdn.microsoft.com/en-us/library/dd371719(v=vs.85).aspx) and [Servermanagercmd](http://technet.microsoft.com/en-us/library/ee344834(WS.10).aspx) (The CLI for Server Manager).  As Servermanagercmd is deprecated, Chef will set the default provider to `Chef::Provider::WindowsFeature::DISM` if DISM is present on the system being configured.  The default provider will fall back to `Chef::Provider::WindowsFeature::ServerManagerCmd`.

For more information on Roles, Role Services and Features see the [Microsoft TechNet article on the topic](http://technet.microsoft.com/en-us/library/cc754923.aspx).  For a complete list of all features that are available on a node type either of the following commands at a command prompt:

    dism /online /Get-Features
    servermanagercmd -query

### Actions

- :install: install a Windows role/feature
- :remove: remove a Windows role/feature

### Attribute Parameters
<commit_msg>Updating windows readme to provide information about firewall rules.<commit_after>Description
===========

Provides a set of Windows-specific primitives (Chef resources) meant to aid in the creation of cookbooks/recipes targeting the Windows platform.

Requirements
============

Platform
--------

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

Cookbooks
---------

* chef_handler (`windows::reboot_handler` leverages the chef_handler LWRP)

Attributes
==========

* `node['windows']['allow_pending_reboots']` - used to configure the `WindowsRebootHandler` (via the `windows::reboot_handler` recipe) to act on pending reboots. default is true (ie act on pending reboots).  The value of this attribute only has an effect if the `windows::reboot_handler` is in a node's run list.

Resource/Provider
=================

windows\_auto\_run
------------------

### Actions
- :create: Create an item to be run at login
- :remove: Remove an item that was previously setup to run at login

### Attribute Parameters
- :name: Name attribute. The name of the value to be stored in the registry
- :program: The program to be run at login
- :args: The arguments for the program

### Examples

  # Run BGInfo at login
  windows_auto_run 'BGINFO' do
    program "C:/Sysinternals/bginfo.exe"
    args "\"C:/Sysinternals/Config.bgi\" /NOLICPROMPT /TIMER:0"
    not_if { Registry.value_exists?(AUTO_RUN_KEY, 'BGINFO') }
    action :create
  end


windows\_batch
--------------
Execute a batch script using the cmd.exe interpreter (much like the script resources for bash, csh, powershell, 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.

### Actions

- :run: run the batch file

### 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.
- 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.

### Examples

    windows_batch "unzip_and_move_ruby" do
      code <<-EOH
      7z.exe x #{Chef::Config[:file_cache_path]}/ruby-1.8.7-p352-i386-mingw32.7z  -oC:\\source -r -y
      xcopy C:\\source\\ruby-1.8.7-p352-i386-mingw32 C:\\ruby /e /y
      EOH
    end

    windows_batch "echo some env vars" do
      code <<-EOH
      echo %TEMP%
      echo %SYSTEMDRIVE%
      echo %PATH%
      echo %WINDIR%
      EOH
    end
	
`windows_firewall`

Gives control to the netsh utility provided by windows to manipulate the firewall settings. 

### Actions

- :open_port: Opens a firewall port

### Attributes

- rule_name: name attribute. Name of the firewall rule.
- port: port to open
- protocol: protocol of port

### Example

windows_firewall 'TheInternet' do
	protocol "TCP"
	port 80
	action [:open_port]
end

windows\_feature
----------------

Windows Roles and Features can be thought of as built-in operating system packages that ship with the OS.  A server role is a set of software programs that, when they are installed and properly configured, lets a computer perform a specific function for multiple users or other computers within a network.  A Role can have multiple Role Services that provide functionality to the Role.  Role services are software programs that provide the functionality of a role. Features are software programs that, although they are not directly parts of roles, can support or augment the functionality of one or more roles, or improve the functionality of the server, regardless of which roles are installed.  Collectively we refer to all of these attributes as 'features'.

This resource allows you to manage these 'features' in an unattended, idempotent way.

There are two providers for the `windows_features` which map into Microsoft's two major tools for managing roles/features: [Deployment Image Servicing and Management (DISM)](http://msdn.microsoft.com/en-us/library/dd371719(v=vs.85).aspx) and [Servermanagercmd](http://technet.microsoft.com/en-us/library/ee344834(WS.10).aspx) (The CLI for Server Manager).  As Servermanagercmd is deprecated, Chef will set the default provider to `Chef::Provider::WindowsFeature::DISM` if DISM is present on the system being configured.  The default provider will fall back to `Chef::Provider::WindowsFeature::ServerManagerCmd`.

For more information on Roles, Role Services and Features see the [Microsoft TechNet article on the topic](http://technet.microsoft.com/en-us/library/cc754923.aspx).  For a complete list of all features that are available on a node type either of the following commands at a command prompt:

    dism /online /Get-Features
    servermanagercmd -query

### Actions

- :install: install a Windows role/feature
- :remove: remove a Windows role/feature

### Attribute Parameters

{'fraction_non_alphanumeric': 0.09406528189910979, 'fraction_numerical': 0.011869436201780416, 'mean_word_length': 3.85405664906385, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3052578', 'n_tokens_mistral': 2862, 'n_tokens_neox': 2697, 'n_words': 1279}