chef-workstation
chef-workstation copied to clipboard
Resources not working when using chef-run on windows? 22.12.1024
Hello Community
Description
I am trying to execute recipe like following (it is work to use chef to install MSSQL on Windows machine)
#
# Cookbook:: windows_install_MSSQL_powershell_DSC
# Recipe:: default
#
# Copyright:: 2023, The Authors, All Rights Reserved.
powershell_script 'Prepare Machine for DSC' do
code <<-EOH
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
Install-Module -Name SqlServerDsc
Install-Module -Name SqlServer
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
EOH
end
file 'c:\\test\\testtest.txt' do
content 'This is a test file'
rights :full_control, '<redacted-win-domain-name>\\administrator'
action :create
end
cookbook_file 'c:\\test\\create_mof_file.ps1' do
source 'create_mof_file.ps1'
action :create
end
Using command chef-run as
chef-run <redacted-node-name> windows_install_MSSQL_powershell_DSC/ --user <user@domain> --password <redacted> --protocol winrm
Result is that no file is created when using workstation. However when same cookbook/recipe is added to run-list of chef-client is executed, file is created as expected. Could you please advise if this is bug or feature?
Chef Workstation Version
chef-run: 0.9.4 chef-server-ctl version: 15.4.0 chef-client: 17.10.3 Chef Workstation: 22.12.1024
Platform Version
Server: RedHat 9.1 Client: Windows Server 2022 Standard