{"id":13781999,"url":"https://github.com/chef-boneyard/windows","last_synced_at":"2025-04-04T21:10:24.139Z","repository":{"id":2726027,"uuid":"3720966","full_name":"chef-boneyard/windows","owner":"chef-boneyard","description":"Development repository for Chef Cookbook windows","archived":false,"fork":false,"pushed_at":"2021-05-27T00:12:07.000Z","size":1842,"stargazers_count":252,"open_issues_count":13,"forks_count":270,"subscribers_count":72,"default_branch":"master","last_synced_at":"2024-05-18T22:15:50.873Z","etag":null,"topics":["chef","cookbook","hacktoberfest","windows"],"latest_commit_sha":null,"homepage":"https://supermarket.chef.io/cookbooks/windows","language":"Ruby","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/chef-boneyard.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null}},"created_at":"2012-03-14T18:42:22.000Z","updated_at":"2024-04-16T15:01:54.000Z","dependencies_parsed_at":"2022-09-09T21:30:41.507Z","dependency_job_id":null,"html_url":"https://github.com/chef-boneyard/windows","commit_stats":null,"previous_names":[],"tags_count":118,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef-boneyard%2Fwindows","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef-boneyard%2Fwindows/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef-boneyard%2Fwindows/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chef-boneyard%2Fwindows/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chef-boneyard","download_url":"https://codeload.github.com/chef-boneyard/windows/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249532,"owners_count":20908212,"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":["chef","cookbook","hacktoberfest","windows"],"created_at":"2024-08-03T18:01:31.879Z","updated_at":"2025-04-04T21:10:24.102Z","avatar_url":"https://github.com/chef-boneyard.png","language":"Ruby","funding_links":[],"categories":["Chef for Windows"],"sub_categories":["Resources - OS configuration"],"readme":"# Windows Cookbook\n\n[![Build status](https://ci.appveyor.com/api/projects/status/9x4uepmm1g4rktie/branch/master?svg=true)](https://ci.appveyor.com/project/ChefWindowsCookbooks/windows/branch/master) [![Cookbook Version](https://img.shields.io/cookbook/v/windows.svg)](https://supermarket.chef.io/cookbooks/windows)\n\nProvides a set of Windows-specific resources to aid in the creation of cookbooks/recipes targeting the Windows platform.\n\n## EOL Notice\n\nThis cookbook is no longer required for managing Windows nodes with Chef Infra. The necessary resources and helpers are now built into Chef Infra Client itself. These built-in resources are more feature rich and execute faster.\n\n## Requirements\n\n### Platforms\n\n- Windows 7 (EOL)\n- Windows Server 2008 R2 (EOL)\n- Windows 8, 8.1\n- Windows Server 2012 (R1, R2)\n- Windows Server 2016\n\n### Chef\n\n- Chef 14.7+\n\n## Resources\n\n### windows_certificate_binding\n\nBinds a certificate to an HTTP port to enable TLS communication.\n\n#### Actions\n\n- `:create` - creates or updates a binding.\n- `:delete` - deletes a binding.\n\n#### Properties\n\n- `cert_name` - name attribute. The thumbprint(hash) or subject that identifies the certificate to be bound.\n- `name_kind` - indicates the type of cert_name. One of :subject (default) or :hash.\n- `address` - the address to bind against. Default is 0.0.0.0 (all IP addresses). One of:\n  - IP v4 address `1.2.3.4`\n  - IP v6 address `[::1]`\n  - Host name `www.foo.com`\n- `port` - the port to bind against. Default is 443.\n- `app_id` - the GUID that defines the application that owns the binding. Default is the values used by IIS.\n- `store_name` - the store to locate the certificate in. One of:\n  - MY (Personal)\n  - CA (Intermediate Certification Authorities)\n  - ROOT (Trusted Root Certification Authorities)\n  - TRUSTEDPUBLISHER (Trusted Publishers)\n  - CLIENTAUTHISSUER (Client Authentication Issuers)\n  - REMOTE DESKTOP (Remote Desktop)\n  - TRUSTEDDEVICES (Trusted Devices)\n  - WEBHOSTING (Web Hosting)\n  - AUTHROOT (Third-Party Root Certification Authorities)\n  - TRUSTEDPEOPLE (Trusted People)\n  - SMARTCARDROOT (Smart Card Trusted Roots)\n  - TRUST (Enterprise Trust)\n\n#### Examples\n\n```ruby\n# Bind the first certificate matching the subject to the default TLS port\nwindows_certificate_binding \"me.acme.com\" do\nend\n```\n\n```ruby\n# Bind a cert from the CA store with the given hash to port 4334\nwindows_certificate_binding \"me.acme.com\" do\n    cert_name    \"d234567890a23f567c901e345bc8901d34567890\"\n    name_kind    :hash\n    store_name    \"CA\"\n    port        4334\nend\n```\n\n### windows_dns\n\n`Note`: This resource is now included in Chef 15 and later. If you are using newer versions of [windows](https://devblogs.microsoft.com/powershell/configuration-in-a-devops-world-windows-powershell-desired-state-configuration/) then should use the core [resource](https://github.com/chef/chef/blob/master/RELEASE_NOTES.md#windows_dns_record-resource) instead of windows_dns.\n\nConfigures A and CNAME records in Windows DNS. This requires the DNSCMD to be installed, which is done by adding the DNS role to the server or installing the Remote Server Admin Tools.\n\n#### Actions\n\n- :create: creates/updates the DNS entry\n- :delete: deletes the DNS entry\n\n#### Properties\n\n- host_name: name attribute. FQDN of the entry to act on.\n- dns_server: the DNS server to update. Default is local machine (.)\n- record_type: the type of record to create. One of A (default) or CNAME\n- target: for A records an array of IP addresses to associate with the host; for CNAME records the FQDN of the host to alias\n- ttl: if \u003e 0 then set the time to live of the record\n\n#### Examples\n\n```ruby\n# Create A record linked to 2 addresses with a 10 minute ttl\nwindows_dns \"m1.chef.test\" do\n    target         ['10.9.8.7', '1.2.3.4']\n    ttl            600\nend\n```\n\n```ruby\n# Delete records. target is mandatory although not used\nwindows_dns \"m1.chef.test\" do\n    action    :delete\n    target    []\nend\n```\n\n```ruby\n# Set an alias against the node in a role\nnodes = search( :node, \"role:my_service\" )\nwindows_dns \"myservice.chef.test\" do\n    record_type    'CNAME'\n    target        nodes[0]['fqdn']\nend\n```\n\n### windows_http_acl\n\nSets the Access Control List for an http URL to grant non-admin accounts permission to open HTTP endpoints.\n\n#### Actions\n\n- `:create` - creates or updates the ACL for a URL.\n- `:delete` - deletes the ACL from a URL.\n\n#### Properties\n\n- `url` - the name of the url to be created/deleted.\n- `sddl` - the DACL string configuring all permissions to URL. Mandatory for create if user is not provided. Can't be use with `user`.\n- `user` - the name (domain\\user) of the user or group to be granted permission to the URL. Mandatory for create if sddl is not provided. Can't be use with `sddl`. Only one user or group can be granted permission so this replaces any previously defined entry. If you receive a parameter error your user may not exist.\n\n#### Examples\n\n```ruby\nwindows_http_acl 'http://+:50051/' do\n    user 'pc\\\\fred'\nend\n```\n\n```ruby\n# Grant access to users \"NT SERVICE\\WinRM\" and \"NT SERVICE\\Wecsvc\" via sddl\nwindows_http_acl 'http://+:5985/' do\n  sddl 'D:(A;;GX;;;S-1-5-80-569256582-2953403351-2909559716-1301513147-412116970)(A;;GX;;;S-1-5-80-4059739203-877974739-1245631912-527174227-2996563517)'\nend\n```\n\n```ruby\nwindows_http_acl 'http://+:50051/' do\n    action :delete\nend\n```\n\n### windows_schannel\n\nUsed to configure the schannel security settings in windows, this is used by dotnet apps and PowerShell to be able to speak to tls 1.2 endpoints\n\n#### Actions\n\n- `configure`: Configures the setting\n\n#### Properties\n\nproperty                 | type       | default       | description\n------------------------ | ---------- | ------------- | -----------------------------------------------------------------------------------------------------------------------------------------------------------\n`use_strong_crypto`             | True, False     | true | Enables or disables the setting\n\n### windows_user_privilege\n\nAdds the `principal` (User/Group) to the specified privileges (such as `Logon as a batch job` or `Logon as a Service`).\n\n#### Actions\n\n- `:add` - add the specified privileges to the `principal`\n- `:remove` - remove the specified privilege of the `principal`\n\n#### Properties\n\n- `principal` - Name attribute, Required, String. The user or group to be granted privileges.\n- `privilege` - Required, String/Array. The privilege(s) to be granted.\n\n#### Examples\n\nGrant the Administrator user the `Logon as a batch job` and `Logon as a service` privilege.\n\n```ruby\nwindows_user_privilege 'Administrator' do\n  privilege %w(SeBatchLogonRight SeServiceLogonRight)\nend\n```\n\nRemove `Logon as a batch job` privilege of Administrator.\n\n```ruby\nwindows_user_privilege 'Administrator' do\n  privilege %w(SeBatchLogonRight)\n  action :remove\nend\n```\n\n#### Available Privileges\n\n```\nSeTrustedCredManAccessPrivilege      Access Credential Manager as a trusted caller\nSeNetworkLogonRight                  Access this computer from the network\nSeTcbPrivilege                       Act as part of the operating system\nSeMachineAccountPrivilege            Add workstations to domain\nSeIncreaseQuotaPrivilege             Adjust memory quotas for a process\nSeInteractiveLogonRight              Allow log on locally\nSeRemoteInteractiveLogonRight        Allow log on through Remote Desktop Services\nSeBackupPrivilege                    Back up files and directories\nSeChangeNotifyPrivilege              Bypass traverse checking\nSeSystemtimePrivilege                Change the system time\nSeTimeZonePrivilege                  Change the time zone\nSeCreatePagefilePrivilege            Create a pagefile\nSeCreateTokenPrivilege               Create a token object\nSeCreateGlobalPrivilege              Create global objects\nSeCreatePermanentPrivilege           Create permanent shared objects\nSeCreateSymbolicLinkPrivilege        Create symbolic links\nSeDebugPrivilege                     Debug programs\nSeDenyNetworkLogonRight              Deny access this computer from the network\nSeDenyBatchLogonRight                Deny log on as a batch job\nSeDenyServiceLogonRight              Deny log on as a service\nSeDenyInteractiveLogonRight          Deny log on locally\nSeDenyRemoteInteractiveLogonRight    Deny log on through Remote Desktop Services\nSeEnableDelegationPrivilege          Enable computer and user accounts to be trusted for delegation\nSeRemoteShutdownPrivilege            Force shutdown from a remote system\nSeAuditPrivilege                     Generate security audits\nSeImpersonatePrivilege               Impersonate a client after authentication\nSeIncreaseWorkingSetPrivilege        Increase a process working set\nSeIncreaseBasePriorityPrivilege      Increase scheduling priority\nSeLoadDriverPrivilege                Load and unload device drivers\nSeLockMemoryPrivilege                Lock pages in memory\nSeBatchLogonRight                    Log on as a batch job\nSeServiceLogonRight                  Log on as a service\nSeSecurityPrivilege                  Manage auditing and security log\nSeRelabelPrivilege                   Modify an object label\nSeSystemEnvironmentPrivilege         Modify firmware environment values\nSeManageVolumePrivilege              Perform volume maintenance tasks\nSeProfileSingleProcessPrivilege      Profile single process\nSeSystemProfilePrivilege             Profile system performance\nSeUnsolicitedInputPrivilege          \"Read unsolicited input from a terminal device\"\nSeUndockPrivilege                    Remove computer from docking station\nSeAssignPrimaryTokenPrivilege        Replace a process level token\nSeRestorePrivilege                   Restore files and directories\nSeShutdownPrivilege                  Shut down the system\nSeSyncAgentPrivilege                 Synchronize directory service data\nSeTakeOwnershipPrivilege             Take ownership of files or other objects\n```\n\n### windows_zipfile\n\n`Note`: This resource has been deprecated as Chef Infra Client 15.0 shipped with a new archive_file resource, which natively handles multiple archive formats. Please update any cookbooks using this resource to instead use the `archive_file` resource: https://docs.chef.io/resource_archive_file.html\n\nMost versions of Windows do not ship with native cli utility for managing compressed files. This resource provides a pure-ruby implementation for managing zip files. Be sure to use the `not_if` or `only_if` meta parameters to guard the resource for idempotence or action will be taken every Chef run.\n\n#### Actions\n\n- `:unzip` - unzip a compressed file\n- `:zip` - zip a directory (recursively)\n\n#### Properties\n\n- `path` - name attribute. The path where files will be (un)zipped to.\n- `source` - source of the zip file (either a URI or local path) for :unzip, or directory to be zipped for :zip.\n- `overwrite` - force an overwrite of the files if they already exist.\n- `checksum` - for :unzip, useful if source is remote, if the local file matches the SHA-256 checksum, Chef will not download it.\n\n#### Examples\n\nUnzip a remote zip file locally\n\n```ruby\nwindows_zipfile 'c:/bin' do\n  source 'http://download.sysinternals.com/Files/SysinternalsSuite.zip'\n  action :unzip\n  not_if {::File.exists?('c:/bin/PsExec.exe')}\nend\n```\n\nUnzip a local zipfile\n\n```ruby\nwindows_zipfile 'c:/the_codez' do\n  source 'c:/foo/baz/the_codez.zip'\n  action :unzip\nend\n```\n\nCreate a local zipfile\n\n```ruby\nwindows_zipfile 'c:/foo/baz/the_codez.zip' do\n  source 'c:/the_codez'\n  action :zip\nend\n```\n\n## Libraries\n\n### WindowsHelper\n\nHelper that allows you to use helpful functions in windows\n\n#### installed_packages\n\nReturns a hash of all DisplayNames installed\n\n```ruby\n# usage in a recipe\n::Chef::DSL::Recipe.send(:include, Windows::Helper)\nhash_of_installed_packages = installed_packages\n```\n\n#### is_package_installed?\n\n- `package_name` - The name of the package you want to query to see if it is installed\n- `returns` - true if the package is installed, false if it the package is not installed\n\nDownload a file if a package isn't installed\n\n```ruby\n# usage in a recipe to not download a file if package is already installed\n::Chef::DSL::Recipe.send(:include, Windows::Helper)\nis_win_sdk_installed = is_package_installed?('Windows Software Development Kit')\n\nremote_file 'C:\\windows\\temp\\windows_sdk.zip' do\n  source 'http://url_to_download/windows_sdk.zip'\n  action :create_if_missing\n  not_if {is_win_sdk_installed}\nend\n```\n\nDo something if a package is installed\n\n```ruby\n# usage in a provider\ninclude Windows::Helper\nif is_package_installed?('Windows Software Development Kit')\n  # do something if package is installed\nend\n```\n\n### Windows::VersionHelper\n\nHelper that allows you to get information on the windows version running on your node. It leverages windows ohai from kernel.os_info, easy to mock and to use even on Linux.\n\n#### core_version?\n\nDetermines whether the given node is running on a Windows Core.\n\n```ruby\nif ::Windows::VersionHelper.core_version? node\n  fail 'Windows Core is not supported'\nend\n```\n\n#### workstation_version?\n\nDetermines whether the given node is a windows workstation version (XP, Vista, 7, 8, 8.1, 10)\n\n```ruby\nif ::Windows::VersionHelper.workstation_version? node\n  fail 'Only server version of windows are supported'\nend\n```\n\n#### server_version?\n\nDetermines whether the given node is a windows server version (Server 2003, Server 2008, Server 2012, Server 2016)\n\n```ruby\nif ::Windows::VersionHelper.server_version? node\n  puts 'Server version of windows are cool'\nend\n```\n\n#### nt_version\n\nDetermines NT version of the given node\n\n```ruby\ncase ::Windows::VersionHelper.nt_version node\n  when '6.0' then 'Windows vista or Server 2008'\n  when '6.1' then 'Windows 7 or Server 2008R2'\n  when '6.2' then 'Windows 8 or Server 2012'\n  when '6.3' then 'Windows 8.1 or Server 2012R2'\n  when '10.0' then 'Windows 10'\nend\n```\n\n## Usage\n\nPlace an explicit dependency on this cookbook (using depends in the cookbook's metadata.rb) from any cookbook where you would like to use the Windows-specific resources/providers that ship with this cookbook.\n\n```ruby\ndepends 'windows'\n```\n\n## License \u0026 Authors\n\n- Author:: Seth Chisamore ([schisamo@chef.io](mailto:schisamo@chef.io))\n- Author:: Doug MacEachern ([dougm@vmware.com](mailto:dougm@vmware.com))\n- Author:: Paul Morton ([pmorton@biaprotect.com](mailto:pmorton@biaprotect.com))\n- Author:: Doug Ireton ([doug.ireton@nordstrom.com](mailto:doug.ireton@nordstrom.com))\n\n```text\nCopyright 2011-2018, Chef Software, Inc.\nCopyright 2010, VMware, Inc.\nCopyright 2011, Business Intelligence Associates, Inc\nCopyright 2012, Nordstrom, Inc.\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchef-boneyard%2Fwindows","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchef-boneyard%2Fwindows","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchef-boneyard%2Fwindows/lists"}