Kitchen converge Windows 2012r2

I am following the tutorial on learn.chef.io https://learn.chef.io/manage-a-web-app/windows/create-the-cookbook/ and first windows-2012r2 for the platform could not be found but got around that with kensykora/windows_2012_r2_standard. When I run kitchen converge it downloads the box and creates it but when it starts the converge part installing chef client and cookbooks I get this error.

C:\chef\chef-repo\cookbooks\awesome_customers_windows>kitchen converge
-----> Starting Kitchen (v1.14.2)
-----> Converging ...
Preparing files for transfer
Preparing dna.json
Resolving cookbook dependencies with Berkshelf 5.2.0...
Removing non-cookbook files before transfer
Preparing validation.pem
Preparing client.rb
Transferring files to

------Exception-------
Class: Kitchen::ActionFailed
Message: 1 actions failed.
Failed to complete #converge action: [[WinRM::FS::Core::FileTransporter] Upload failed (exitcode: 0), but stderr present
Cannot create "C:\tmp\kitchen" because a file or directory with the same name already exists.
At line:12 char:40

  • $path | ? {-not (test-path $)} | % {$null = mkdir $}
  •                                    ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (C:\tmp\kitchen\cache:String) [New-Item], IOException
    • FullyQualifiedErrorId : CreateDirectoryIOError,Microsoft.PowerShell.Commands.NewItemCommand
      Cannot create "C:\tmp\kitchen" because a file or directory with the same name already exists.
      At line:12 char:40
  • $path | ? {-not (test-path $)} | % {$null = mkdir $}
  •                                    ~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (C:\tmp\kitchen\cookbooks:String) [New-Item], IOException
    • FullyQualifiedErrorId : CreateDirectoryIOError,Microsoft.PowerShell.Commands.NewItemCommand
      Could not find a part of the path 'C:\tmp\kitchen\cookbooks'.
      At line:47 char:17
  • dir $unpack | cp -dest "$dst/" -force -recurse
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (metadata.json:FileInfo) [Copy-Item], DirectoryNotFoundException
    • FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand
      Could not find a part of the path 'C:\tmp\kitchen\cookbooks'.
      At line:47 char:17
  • dir $unpack | cp -dest "$dst/" -force -recurse
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (README.md:FileInfo) [Copy-Item], DirectoryNotFoundException
    • FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand
      Could not find a part of the path 'C:\tmp\kitchen\cookbooks'.
      At line:47 char:17
  • dir $unpack | cp -dest "$dst/" -force -recurse
  •             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : WriteError: (default.rb:FileInfo) [Copy-Item], DirectoryNotFoundException
    • FullyQualifiedErrorId : CopyDirectoryInfoItemIOError,Microsoft.PowerShell.Commands.CopyItemCommand
      ] on default-kensykora-windows-2012-r2-standard

Please see .kitchen/logs/kitchen.log for more details
Also try running kitchen diagnose --all for configuration

Any ideas on how to resolve this issue?

Can you share your kitchen.yml? I am wondering if your platform does not start with “win” and it is treating your box as a Linux machine.

Here is my .kitchen.yml file.

driver:
name: vagrant
network:
- [“private_network”, {ip: “192.168.35.35”}]

provisioner:
name: chef_zero

You may wish to disable always updating cookbooks in CI or other testing environments.

For example:

always_update_cookbooks: <%= !ENV[‘CI’] %>

always_update_cookbooks: true

transport:
name: winrm
elevated: true

platforms:

  • name: kensykora/windows_2012_r2_standard
    driver:
    customize:
    memory: 2048

suites:

  • name: default
    run_list:
    • recipe[awesome_customers_windows::default]
      attributes:

Change

platforms:
- name: kensykora/windows_2012_r2_standard
driver:
customize:
memory: 2048

to

platforms:
- name: windows_2012_r2_standard
  driver:
    box: kensykora/windows_2012_r2_standard
    customize:
    memory: 2048

You want your platform name to start with “win” otherwise your box is treated as a linux box.

Thanks Matt that did the trick.

Hi Matt_Wrock:
I am trying to connect with my node. but unable to connect Please help me.
PS C:\chef-repo> knife wsman test 55.186.161.111 --manual-list
WARNING: Failed to connect to 55.186.161.111 at http://55.186.161.111:5985/wsman.
ERROR: Failed to connect to 1 nodes.