Invalid directory access

Hi

I am executing "ABC.msi" file through chef-recipe. This ABC.msi will create a directory with name ABC in c drive. In the same recipe, I am also accessing ABC directory. but I am getting below error:

[2018-09-07T01:51:00-07:00] ERROR: Remote chef-client error follows:
[2018-09-07T01:51:00-07:00] ERROR: SystemCallError: execute[Create_ABCService_Window_Service] (Hello::create_ABC_service line 8) had an error: SystemCallError: The directory name is invalid. - CreateProcessW

Recipe:

# Install ABC installer
execute 'ABC-installer' do
   cwd "#{Chef::Config['file_cache_path']}/ABC"
   command "ABC.msi"
 end

# Create ABCService window service
execute 'Create_ABCService_Window_Service' do
        cwd "C:/ABC/Server/bin/service"
	command "installABCService.bat"
end

But when I am dividing the above recipe into two parts and executes them separately, then it is working fine:
recipe_1.rb

# Install ABC installer
execute 'ABC-installer' do
   cwd "#{Chef::Config['file_cache_path']}/ABC"
   command "ABC.msi"
 end

recipe.rb_2.rb

# Create ABCService window service
execute 'Create_ABCService_Window_Service' do
       cwd "C:/ABC/Server/bin/service"
       command "installABCService.bat"
end

Hello @Larryc
can you help me to resolve this?

I believe the problem you are having is that when running the msi file this way it is not finishing it's run before the service create kicks off so the folder doesn't exist. Try using windows_package instead to install the msi file.

https://docs.chef.io/resource_windows_package.html

Thanks @Larryc, I will try this and let you know.

Larryc, is there any way to echo on chef-workstation cmd? So user will know what action completed in recipe.

Presently, I can see only below information on chef-workstation:

C:\chef-repo\cookbooks\MyCookBook>chef-run winrm://username@chef-client recipes\default.rb --password Password
 [?] Generated local policyfile
 [?] [chef-node2] Connected.
 [?] [chef-node2] Chef client version 14.4.56 already installed on target.
 [?] [chef-node2] Successfully converged target!

I don't see any flgs you could set using chef-run to make that work. I think you can see the logging under c:\chef on the client.