Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resources not working when using chef-run on windows? 22.12.1024 #3038

Open
pvlbrbc opened this issue Jan 21, 2023 · 1 comment
Open

Resources not working when using chef-run on windows? 22.12.1024 #3038

pvlbrbc opened this issue Jan 21, 2023 · 1 comment
Labels
Status: Untriaged An issue that has yet to be triaged.

Comments

@pvlbrbc
Copy link

pvlbrbc commented Jan 21, 2023

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

chef-run

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

@pvlbrbc pvlbrbc added the Status: Untriaged An issue that has yet to be triaged. label Jan 21, 2023
@pvlbrbc
Copy link
Author

pvlbrbc commented Jan 23, 2023

This is the output from Workstation log:

[2023-01-23T20:05:33+01:00] INFO: Initialized logger
[2023-01-23T20:05:33+01:00] DEBUG: winrm-fs requested, loading WinRM::FS gem (~> 1.0)
[2023-01-23T20:05:33+01:00] DEBUG: winrm-fs library loaded
[2023-01-23T20:05:33+01:00] DEBUG: winrm-elevated requested, loading WinRM-elevated gem (~> 1.2.2)
[2023-01-23T20:05:33+01:00] DEBUG: winrm-elevated library loaded
[2023-01-23T20:05:33+01:00] DEBUG: [ChefApply::Action::GenerateCookbookFromRecipe] Action: generating, Action Data: []
[2023-01-23T20:05:33+01:00] DEBUG: Beginning to look for recipe specified as windows_install_MSSQL_powershell_DSC/
[2023-01-23T20:05:33+01:00] DEBUG: Found full cookbook at path '/home/pavel/github_test/chef/cookbooks/windows_install_MSSQL_powershell_DSC' and using recipe 'default'
[2023-01-23T20:05:33+01:00] DEBUG: [ChefApply::Action::GenerateCookbookFromRecipe] Action: success, Action Data: []
[2023-01-23T20:05:33+01:00] DEBUG: [ChefApply::Action::GenerateLocalPolicy] Action: generating, Action Data: []
[2023-01-23T20:05:36+01:00] DEBUG: [ChefApply::Action::GenerateLocalPolicy] Action: exporting, Action Data: []
[2023-01-23T20:05:36+01:00] DEBUG: [ChefApply::Action::GenerateLocalPolicy] Action: success, Action Data: []
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (Write-Host '[WinRM] Established
')
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e83a7e18 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e83a6c48 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e842cd98 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] remote shell created with shell_id: 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Command created for Write-Host '[WinRM] Established
'
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 311634B2-A870-47C8-85C3-9ED0F142E273
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] creating command_id: 311634B2-A870-47C8-85C3-9ED0F142E273 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] cleaning up command_id: 311634B2-A870-47C8-85C3-9ED0F142E273 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (cmd.exe /c ver)
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Command created for cmd.exe /c ver
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 11E6B965-B32A-45AC-ACC6-E060BD8D8877
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] creating command_id: 11E6B965-B32A-45AC-ACC6-E060BD8D8877 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] cleaning up command_id: 11E6B965-B32A-45AC-ACC6-E060BD8D8877 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (wmic os get * /format:list)
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Command created for wmic os get * /format:list
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: FE5D0650-7EEC-4341-9085-B6C245D1DFFC
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] creating command_id: FE5D0650-7EEC-4341-9085-B6C245D1DFFC on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:36+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: FE5D0650-7EEC-4341-9085-B6C245D1DFFC on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (wmic cpu get architecture /format:list)
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for wmic cpu get architecture /format:list
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 24357B38-DD9B-4BD9-BA8A-C97F42B9BD41
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 24357B38-DD9B-4BD9-BA8A-C97F42B9BD41 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 24357B38-DD9B-4BD9-BA8A-C97F42B9BD41 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> ((Test-Path -Path "c:\opscode\chef\version-manifest.json").ToString())
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for (Test-Path -Path "c:\opscode\chef\version-manifest.json").ToString()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 08F1D723-C1F9-4927-8331-3468AFFEA44F
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 08F1D723-C1F9-4927-8331-3468AFFEA44F on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 08F1D723-C1F9-4927-8331-3468AFFEA44F on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> ((Get-ItemProperty -Path "c:\opscode\chef\version-manifest.json").attributes.ToString())
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for (Get-ItemProperty -Path "c:\opscode\chef\version-manifest.json").attributes.ToString()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: E79016EE-D822-4C51-B6A3-3492D6A74EA7
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: E79016EE-D822-4C51-B6A3-3492D6A74EA7 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: E79016EE-D822-4C51-B6A3-3492D6A74EA7 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (Get-Content("c:\opscode\chef\version-manifest.json") | Out-String)
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for Get-Content("c:\opscode\chef\version-manifest.json") | Out-String
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: CA02E7A8-46B3-4FF8-A688-6A381CC56609
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: CA02E7A8-46B3-4FF8-A688-6A381CC56609 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: CA02E7A8-46B3-4FF8-A688-6A381CC56609 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [ChefApply::Action::InstallChef] Action: already_installed, Action Data: []
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> ($parent = [System.IO.Path]::GetTempPath();[string] $name = [System.Guid]::NewGuid();$tmp = New-Item -ItemType Directory -Path (Join-Path $parent $name);$tmp.FullName)
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for $parent = [System.IO.Path]::GetTempPath();[string] $name = [System.Guid]::NewGuid();$tmp = New-Item -ItemType Directory -Path (Join-Path $parent $name);$tmp.FullName
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 81FE9AC9-3F4F-46C9-9539-CB1DAF6668BF
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 81FE9AC9-3F4F-46C9-9539-CB1DAF6668BF on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 81FE9AC9-3F4F-46C9-9539-CB1DAF6668BF on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [ChefApply::Action::ConvergeTarget] Action: creating_remote_policy, Action Data: []
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (Write-Host '[WinRM] Established
')
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for Write-Host '[WinRM] Established
'
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 2BB81D29-9074-4810-8892-119B9EF6629A
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 2BB81D29-9074-4810-8892-119B9EF6629A on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 2BB81D29-9074-4810-8892-119B9EF6629A on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:37+01:00] DEBUG: creating hash for file C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz
[2023-01-23T20:05:37+01:00] DEBUG: Running check_files.ps1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e840e938 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e840da10 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e84dac90 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] remote shell created with shell_id: BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for $hash_file = @{
  "6e00c1b458a6643a31d134c34755fe993f0ea09c" = @{
    "target" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz";
    "src_basename" = "windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz";
    "dst" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz"
  }
}

Function Cleanup($disposable) {
  if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
    $disposable.Dispose()
  }
}

Function Check-Files($h) {
  return $h.GetEnumerator() | ForEach-Object {
    $dst = Unresolve-Path $_.Value.target
    $dst_changed = $false
    if(Test-Path $dst -PathType Container) {
      $dst_changed = $true
      $dst = Join-Path $dst $_.Value.src_basename
    }
    New-Object psobject -Property @{
      chk_exists = ($exists = Test-Path $dst -PathType Leaf)
      src_sha1 = ($sMd5 = $_.Key)
      dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
      chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
      verifies = if ($dirty -eq $false) { $true } else { $false }
      target_is_folder = $dst_changed
    }
  } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
}

Function Get-SHA1Sum($src) {
  Try {
    $c = [System.Security.Cryptography.SHA1]::Create()
    $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
    return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
  } 
  Finally {
    Cleanup $c
    Cleanup $in
  }
}

Function Unresolve-Path($path) {
  if ($path -eq $null) {
    return $null
  }
  else {
    return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
  }
}

Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 1D257206-3686-4E56-A4CB-A0C36D4B14BB
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 1D257206-3686-4E56-A4CB-A0C36D4B14BB on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 1D257206-3686-4E56-A4CB-A0C36D4B14BB on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: Parsing CSV Response
[2023-01-23T20:05:37+01:00] DEBUG: "chk_exists","src_sha1","dst_sha1","chk_dirty","verifies","target_is_folder"
"False","6e00c1b458a6643a31d134c34755fe993f0ea09c",,"True","False","False"

[2023-01-23T20:05:37+01:00] DEBUG: Uploading /tmp/cw20230123-53930-oiohpn/windows_install_MSSQL_powershell_DSC/export/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for             $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz")
            $parent = Split-Path $to
            if(!(Test-path $parent)) { mkdir $parent | Out-Null }
            $fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
                $to,
                [system.io.filemode]::Create,
                [System.io.FileAccess]::Write,
                [System.IO.FileShare]::ReadWrite
            )
            # Powershell caches ScrpitBlocks in a dictionary
            # keyed on the script block text. Thats just great
            # unless the script is super large and called a gillion
            # times like we might do. In such a case it will saturate the
            # Large Object Heap and lead to Out Of Memory exceptions
            # for large files or folders. So we call the internal method
            # ClearScriptBlockCache to clear it.
            $bindingFlags= [Reflection.BindingFlags] "NonPublic,Static"
            $method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: C31AC069-338D-4E17-892B-DC211C636AB5
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: C31AC069-338D-4E17-892B-DC211C636AB5 on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: C31AC069-338D-4E17-892B-DC211C636AB5 on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for             if($method) { $method.Invoke($Null, $Null) }
            $bytes=[Convert]::FromBase64String('H4sIAIDazmMAA+0c7XLbNjJ/i6dA7R9KPBYtUV+2JrnWtRRXM7GtWk4zc0lGhkjIYk0SLAjaUTq5uYfoz3u6PsntApRE0crZTmXn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P+bmciQ6R1Kw8fQC3eT6nL48Xp/chXs/vVIpRsybbzUtOuNBLoezM5AeHiH2fW8gmTRs1tft7+jK2ypl0nLX/3QU5zwAX2D/N6or+/9e0t3IP7Un09fJXLv/lytX/P/lh/7+lwcif3zLyl5KaLN5s2Cwddg5Uc5QPxU0MWDSUFLIx2DSzWw06SZdsPFahOAbXabAjQagjbQIjw8OmDOC3V17vPFqKXUF7BkYlkCfPy+2j34m34GxVuz2MvdVi6kuog3a9M7aiQQpc5cWtWHW7e1DOZdj8l1aNzVk0/I5U/aaKrPyLnPOYS/raqWAy7TiYbLPFRjKYF8FSZC+pYXa1rZVs8AipMWXAnZn6BR2Rr94hGh3fMFpvnuH8QjmE/8s9UEZDkwOAgr6uAb+M4oVtD8d7Kw0ZLc5TIClWFcKf5MWcnbdu3csa/ZBOxihSFzTOIFSaqaDOE/WAldRKp/UO1BYVAOKF6LB9LWnwqNM1tb0Dumd4bj1/l8ulxu1B77/P5DUZR9+5gwWrJv5Jr/gJv8N4r8bjbz+By2e0A/3wYC72/8nE2sZVN5ZKtsNim9peZFZCO5qJMy908EEi33t7j/6dA+yvv37vyqlaunh3/98EPN/9f6v1fu/Vu//eszv/5p/z8td4Li9/m/b9dX7P+4l5eWvz+uX/A7Q6/T/K/G/5apde+j+vweS9P4/0VS+fPtbtgZx9wvfKq3SKq3SI0//BaJ5xWUAZgAA')
            $fileStream.Write($bytes, 0, $bytes.length)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 4D51AE58-3C0D-4E58-93F6-2939E4A5032E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 4D51AE58-3C0D-4E58-93F6-2939E4A5032E on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 4D51AE58-3C0D-4E58-93F6-2939E4A5032E on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for $fileStream.Dispose()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 77F84DB5-27C3-4573-AA2E-665FEAE13888
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 77F84DB5-27C3-4573-AA2E-665FEAE13888 on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] cleaning up command_id: 77F84DB5-27C3-4573-AA2E-665FEAE13888 on shell_id BAA63F85-157F-4120-AE83-984A1AD48C5E
[2023-01-23T20:05:37+01:00] DEBUG: Finished uploading /tmp/cw20230123-53930-oiohpn/windows_install_MSSQL_powershell_DSC/export/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz (5.14 KB over 1 chunks) in (0m0.15s)
[2023-01-23T20:05:37+01:00] DEBUG: No remote files to extract, skipping
[2023-01-23T20:05:37+01:00] DEBUG: Uploaded 1 items dirty_check: (0m0.31s) stream_files: (0m0.15s) extract: (0m0.00s) 
[2023-01-23T20:05:37+01:00] DEBUG: creating hash for file C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb
[2023-01-23T20:05:37+01:00] DEBUG: Running check_files.ps1
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e8e75d18 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e8e74da0 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e8f06980 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] remote shell created with shell_id: D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Command created for $hash_file = @{
  "78608501e6106c036eeb89d9e40b17c22fecc866" = @{
    "target" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb";
    "src_basename" = "20230123-53930-v6q7lh";
    "dst" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb"
  }
}

Function Cleanup($disposable) {
  if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
    $disposable.Dispose()
  }
}

Function Check-Files($h) {
  return $h.GetEnumerator() | ForEach-Object {
    $dst = Unresolve-Path $_.Value.target
    $dst_changed = $false
    if(Test-Path $dst -PathType Container) {
      $dst_changed = $true
      $dst = Join-Path $dst $_.Value.src_basename
    }
    New-Object psobject -Property @{
      chk_exists = ($exists = Test-Path $dst -PathType Leaf)
      src_sha1 = ($sMd5 = $_.Key)
      dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
      chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
      verifies = if ($dirty -eq $false) { $true } else { $false }
      target_is_folder = $dst_changed
    }
  } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
}

Function Get-SHA1Sum($src) {
  Try {
    $c = [System.Security.Cryptography.SHA1]::Create()
    $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
    return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
  } 
  Finally {
    Cleanup $c
    Cleanup $in
  }
}

Function Unresolve-Path($path) {
  if ($path -eq $null) {
    return $null
  }
  else {
    return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
  }
}

Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 8272D923-8FF2-48FE-967E-8EE31AC1EC8F
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] creating command_id: 8272D923-8FF2-48FE-967E-8EE31AC1EC8F on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:37+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 8272D923-8FF2-48FE-967E-8EE31AC1EC8F on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: Parsing CSV Response
[2023-01-23T20:05:38+01:00] DEBUG: "chk_exists","src_sha1","dst_sha1","chk_dirty","verifies","target_is_folder"
"False","78608501e6106c036eeb89d9e40b17c22fecc866",,"True","False","False"

[2023-01-23T20:05:38+01:00] DEBUG: Uploading /tmp/20230123-53930-v6q7lh to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for             $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb")
            $parent = Split-Path $to
            if(!(Test-path $parent)) { mkdir $parent | Out-Null }
            $fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
                $to,
                [system.io.filemode]::Create,
                [System.io.FileAccess]::Write,
                [System.IO.FileShare]::ReadWrite
            )
            # Powershell caches ScrpitBlocks in a dictionary
            # keyed on the script block text. Thats just great
            # unless the script is super large and called a gillion
            # times like we might do. In such a case it will saturate the
            # Large Object Heap and lead to Out Of Memory exceptions
            # for large files or folders. So we call the internal method
            # ClearScriptBlockCache to clear it.
            $bindingFlags= [Reflection.BindingFlags] "NonPublic,Static"
            $method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 3A46C6C6-E2CA-4264-99DA-613F697F2E0D
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 3A46C6C6-E2CA-4264-99DA-613F697F2E0D on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 3A46C6C6-E2CA-4264-99DA-613F697F2E0D on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for             if($method) { $method.Invoke($Null, $Null) }
            $bytes=[Convert]::FromBase64String('bG9jYWxfbW9kZSB0cnVlCmNvbG9yIGZhbHNlCmNhY2hlX3BhdGggIiN7RU5WWydBUFBEQVRBJ119L2NoZWYtd29ya3N0YXRpb24iCmNoZWZfcmVwb19wYXRoICIje0VOVlsnQVBQREFUQSddfS9jaGVmLXdvcmtzdGF0aW9uIgpyZXF1aXJlX3JlbGF0aXZlICJyZXBvcnRlciIKcmVwb3J0ZXIgPSBDaGVmQXBwbHk6OlJlcG9ydGVyLm5ldwpyZXBvcnRfaGFuZGxlcnMgPDwgcmVwb3J0ZXIKZXhjZXB0aW9uX2hhbmRsZXJzIDw8IHJlcG9ydGVyCmNoZWZfbGljZW5zZSAiYWNjZXB0Igo=')
            $fileStream.Write($bytes, 0, $bytes.length)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 40FA7551-F0E4-4853-9365-377AA58BEB84
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 40FA7551-F0E4-4853-9365-377AA58BEB84 on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 40FA7551-F0E4-4853-9365-377AA58BEB84 on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for $fileStream.Dispose()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 80213CAD-23BE-403D-8A2B-EA123CD404A3
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 80213CAD-23BE-403D-8A2B-EA123CD404A3 on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 80213CAD-23BE-403D-8A2B-EA123CD404A3 on shell_id D5C061E7-3B7E-4D9C-A394-3F7C1FF9BA9C
[2023-01-23T20:05:38+01:00] DEBUG: Finished uploading /tmp/20230123-53930-v6q7lh to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb (0.36 KB over 1 chunks) in (0m0.08s)
[2023-01-23T20:05:38+01:00] DEBUG: No remote files to extract, skipping
[2023-01-23T20:05:38+01:00] DEBUG: Uploaded 1 items dirty_check: (0m0.28s) stream_files: (0m0.08s) extract: (0m0.00s) 
[2023-01-23T20:05:38+01:00] DEBUG: creating hash for file C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/reporter.rb
[2023-01-23T20:05:38+01:00] DEBUG: Running check_files.ps1
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x0000000006c9d280 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x0000000006c9c2b8 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x0000000006d2c930 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] remote shell created with shell_id: E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for $hash_file = @{
  "303781f2fc35d87891f0adde9fdcfd6a4387b488" = @{
    "target" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/reporter.rb";
    "src_basename" = "20230123-53930-fzggqq";
    "dst" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/reporter.rb"
  }
}

Function Cleanup($disposable) {
  if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
    $disposable.Dispose()
  }
}

Function Check-Files($h) {
  return $h.GetEnumerator() | ForEach-Object {
    $dst = Unresolve-Path $_.Value.target
    $dst_changed = $false
    if(Test-Path $dst -PathType Container) {
      $dst_changed = $true
      $dst = Join-Path $dst $_.Value.src_basename
    }
    New-Object psobject -Property @{
      chk_exists = ($exists = Test-Path $dst -PathType Leaf)
      src_sha1 = ($sMd5 = $_.Key)
      dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
      chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
      verifies = if ($dirty -eq $false) { $true } else { $false }
      target_is_folder = $dst_changed
    }
  } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
}

Function Get-SHA1Sum($src) {
  Try {
    $c = [System.Security.Cryptography.SHA1]::Create()
    $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
    return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
  } 
  Finally {
    Cleanup $c
    Cleanup $in
  }
}

Function Unresolve-Path($path) {
  if ($path -eq $null) {
    return $null
  }
  else {
    return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
  }
}

Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 8C4FA774-162C-48D7-9E73-33656393BDDF
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 8C4FA774-162C-48D7-9E73-33656393BDDF on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 8C4FA774-162C-48D7-9E73-33656393BDDF on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: Parsing CSV Response
[2023-01-23T20:05:38+01:00] DEBUG: "chk_exists","src_sha1","dst_sha1","chk_dirty","verifies","target_is_folder"
"False","303781f2fc35d87891f0adde9fdcfd6a4387b488",,"True","False","False"

[2023-01-23T20:05:38+01:00] DEBUG: Uploading /tmp/20230123-53930-fzggqq to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/reporter.rb
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for             $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/reporter.rb")
            $parent = Split-Path $to
            if(!(Test-path $parent)) { mkdir $parent | Out-Null }
            $fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
                $to,
                [system.io.filemode]::Create,
                [System.io.FileAccess]::Write,
                [System.IO.FileShare]::ReadWrite
            )
            # Powershell caches ScrpitBlocks in a dictionary
            # keyed on the script block text. Thats just great
            # unless the script is super large and called a gillion
            # times like we might do. In such a case it will saturate the
            # Large Object Heap and lead to Out Of Memory exceptions
            # for large files or folders. So we call the internal method
            # ClearScriptBlockCache to clear it.
            $bindingFlags= [Reflection.BindingFlags] "NonPublic,Static"
            $method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: E92E00E7-35B2-4047-BCB7-8D1E5D2BBFB4
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: E92E00E7-35B2-4047-BCB7-8D1E5D2BBFB4 on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: E92E00E7-35B2-4047-BCB7-8D1E5D2BBFB4 on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for             if($method) { $method.Invoke($Null, $Null) }
            $bytes=[Convert]::FromBase64String('IwojIENvcHlyaWdodDo6IENvcHlyaWdodCAoYykgMjAxNyBDaGVmIFNvZnR3YXJlIEluYy4KIyBMaWNlbnNlOjogQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wCiMKIyBMaWNlbnNlZCB1bmRlciB0aGUgQXBhY2hlIExpY2Vuc2UsIFZlcnNpb24gMi4wICh0aGUgIkxpY2Vuc2UiKTsKIyB5b3UgbWF5IG5vdCB1c2UgdGhpcyBmaWxlIGV4Y2VwdCBpbiBjb21wbGlhbmNlIHdpdGggdGhlIExpY2Vuc2UuCiMgWW91IG1heSBvYnRhaW4gYSBjb3B5IG9mIHRoZSBMaWNlbnNlIGF0CiMKIyAgICAgaHR0cDovL3d3dy5hcGFjaGUub3JnL2xpY2Vuc2VzL0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zdGFydF90aW1lXS50b19zCiAgICAgIHJ1bl9kYXRhWzplbmRfdGltZV0gPSBydW5fZGF0YVs6ZW5kX3RpbWVdLnRvX3MKCiAgICAgIENoZWY6OkZpbGVDYWNoZS5zdG9yZSgicnVuLXJlcG9ydC5qc29uIiwgQ2hlZjo6SlNPTkNvbXBhdC50b19qc29uX3ByZXR0eShydW5fZGF0YSksIDA2NDApCiAgICBlbmQKICBlbmQKZW5kCg==')
            $fileStream.Write($bytes, 0, $bytes.length)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: B22D4378-85D5-4EAA-AE47-DC6592F3E097
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: B22D4378-85D5-4EAA-AE47-DC6592F3E097 on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: B22D4378-85D5-4EAA-AE47-DC6592F3E097 on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for $fileStream.Dispose()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 28FD89A3-9157-4B82-B8D5-B3E8E5942616
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 28FD89A3-9157-4B82-B8D5-B3E8E5942616 on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 28FD89A3-9157-4B82-B8D5-B3E8E5942616 on shell_id E247AB9E-60B6-4585-A31B-E968F163E836
[2023-01-23T20:05:38+01:00] DEBUG: Finished uploading /tmp/20230123-53930-fzggqq to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/reporter.rb (1.708 KB over 1 chunks) in (0m0.08s)
[2023-01-23T20:05:38+01:00] DEBUG: No remote files to extract, skipping
[2023-01-23T20:05:38+01:00] DEBUG: Uploaded 1 items dirty_check: (0m0.28s) stream_files: (0m0.08s) extract: (0m0.00s) 
[2023-01-23T20:05:38+01:00] DEBUG: [ChefApply::Action::ConvergeTarget] Action: uploading_trusted_certs, Action Data: []
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (New-Item -ItemType Directory -Force -Path C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs)
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for New-Item -ItemType Directory -Force -Path C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 8BBB4837-2F56-45CC-B791-68B50D998156
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 8BBB4837-2F56-45CC-B791-68B50D998156 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 8BBB4837-2F56-45CC-B791-68B50D998156 on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:38+01:00] DEBUG: creating hash for file C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/localhost.crt
[2023-01-23T20:05:38+01:00] DEBUG: Running check_files.ps1
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e89d56c8 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e89d47a0 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e8a668a8 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] remote shell created with shell_id: CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for $hash_file = @{
  "86d891979863a214daff0ef216ee697533eb5ec9" = @{
    "target" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/localhost.crt";
    "src_basename" = "localhost.crt";
    "dst" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/localhost.crt"
  }
}

Function Cleanup($disposable) {
  if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
    $disposable.Dispose()
  }
}

Function Check-Files($h) {
  return $h.GetEnumerator() | ForEach-Object {
    $dst = Unresolve-Path $_.Value.target
    $dst_changed = $false
    if(Test-Path $dst -PathType Container) {
      $dst_changed = $true
      $dst = Join-Path $dst $_.Value.src_basename
    }
    New-Object psobject -Property @{
      chk_exists = ($exists = Test-Path $dst -PathType Leaf)
      src_sha1 = ($sMd5 = $_.Key)
      dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
      chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
      verifies = if ($dirty -eq $false) { $true } else { $false }
      target_is_folder = $dst_changed
    }
  } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
}

Function Get-SHA1Sum($src) {
  Try {
    $c = [System.Security.Cryptography.SHA1]::Create()
    $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
    return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
  } 
  Finally {
    Cleanup $c
    Cleanup $in
  }
}

Function Unresolve-Path($path) {
  if ($path -eq $null) {
    return $null
  }
  else {
    return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
  }
}

Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 063B0538-04CB-47B3-9CFC-2259EDF18FE8
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 063B0538-04CB-47B3-9CFC-2259EDF18FE8 on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 063B0538-04CB-47B3-9CFC-2259EDF18FE8 on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: Parsing CSV Response
[2023-01-23T20:05:38+01:00] DEBUG: "chk_exists","src_sha1","dst_sha1","chk_dirty","verifies","target_is_folder"
"False","86d891979863a214daff0ef216ee697533eb5ec9",,"True","False","False"

[2023-01-23T20:05:38+01:00] DEBUG: Uploading /home/pavel/.chef/trusted_certs/localhost.crt to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/localhost.crt
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for             $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/localhost.crt")
            $parent = Split-Path $to
            if(!(Test-path $parent)) { mkdir $parent | Out-Null }
            $fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
                $to,
                [system.io.filemode]::Create,
                [System.io.FileAccess]::Write,
                [System.IO.FileShare]::ReadWrite
            )
            # Powershell caches ScrpitBlocks in a dictionary
            # keyed on the script block text. Thats just great
            # unless the script is super large and called a gillion
            # times like we might do. In such a case it will saturate the
            # Large Object Heap and lead to Out Of Memory exceptions
            # for large files or folders. So we call the internal method
            # ClearScriptBlockCache to clear it.
            $bindingFlags= [Reflection.BindingFlags] "NonPublic,Static"
            $method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: A6966ACB-29DC-4334-B2B1-49496F07EA58
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: A6966ACB-29DC-4334-B2B1-49496F07EA58 on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: A6966ACB-29DC-4334-B2B1-49496F07EA58 on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for             if($method) { $method.Invoke($Null, $Null) }
            $bytes=[Convert]::FromBase64String('LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUQ4RENDQXRpZ0F3SUJBZ0lWQU5QNW53UndmUlhTUnpGYXdsTmczby84VnBKM01BMEdDU3FHU0liM0RRRUIKQ3dVQU1FZ3hDekFKQmdOVkJBWVRBbFZUTVJBd0RnWURWUVFLREFkWmIzVkRiM0p3TVJNd0VRWURWUVFMREFwUApjR1Z5WVhScGIyNXpNUkl3RUFZRFZRUUREQWxzYjJOaGJHaHZjM1F3SGhjTk1qRXdOakE1TVRBMU5qUTNXaGNOCk16RXdOakEzTVRBMU5qUTNXakJJTVFzd0NRWURWUVFHRXdKVlV6RVFNQTRHQTFVRUNnd0hXVzkxUTI5eWNERVQKTUJFR0ExVUVDd3dLVDNCbGNtRjBhVzl1Y3pFU01CQUdBMVVFQXd3SmJHOWpZV3hvYjNOME1JSUJJakFOQmdrcQpoa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTdHM1VOcDhtUmd2NndDbzhrNGR4VE1FWW0vQ1Q2S0VnClJQRFZweHhpZXEyY1pmN1lSUndVekI3cGNpT01mWG0rdFRYUWliYVR2VjFYZlcxRTYrZGVBcWQvd285clVRSk8KTWdmZDZoNTgweFVzMDFZSU51L1VHVnRQdXhTNW43dm90T21DZFVxQkZ1MGhuK21qSmNtVzhKRFFXbm1UVWVXTQp3dEVBWFZwS2ZNR0VpUTJPaGh1c1d3czJsUHpUYi9SeE02akc4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k5b0NSdU0rcjhVeHd5ClhhanBOUT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K')
            $fileStream.Write($bytes, 0, $bytes.length)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: E2F0F9EC-7B30-4E05-BB10-B1A74BB9D302
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: E2F0F9EC-7B30-4E05-BB10-B1A74BB9D302 on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: E2F0F9EC-7B30-4E05-BB10-B1A74BB9D302 on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Command created for $fileStream.Dispose()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 7878CFE3-340A-453C-B1F4-A61E4A782E5B
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] creating command_id: 7878CFE3-340A-453C-B1F4-A61E4A782E5B on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] cleaning up command_id: 7878CFE3-340A-453C-B1F4-A61E4A782E5B on shell_id CB4EA8A1-370C-4E42-89F7-5EBC9B0D7914
[2023-01-23T20:05:38+01:00] DEBUG: Finished uploading /home/pavel/.chef/trusted_certs/localhost.crt to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/localhost.crt (1.904 KB over 1 chunks) in (0m0.09s)
[2023-01-23T20:05:38+01:00] DEBUG: No remote files to extract, skipping
[2023-01-23T20:05:38+01:00] DEBUG: Uploaded 1 items dirty_check: (0m0.28s) stream_files: (0m0.09s) extract: (0m0.00s) 
[2023-01-23T20:05:38+01:00] DEBUG: creating hash for file C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat.windomain.pavel.crt
[2023-01-23T20:05:38+01:00] DEBUG: Running check_files.ps1
[2023-01-23T20:05:38+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00000000061d4da8 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00000000061ccef0 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00000000063846f8 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] remote shell created with shell_id: 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for $hash_file = @{
  "d106206d66105aee23402bc113acf660240ec3ad" = @{
    "target" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat.windomain.pavel.crt";
    "src_basename" = "redhat.windomain.pavel.crt";
    "dst" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat.windomain.pavel.crt"
  }
}

Function Cleanup($disposable) {
  if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
    $disposable.Dispose()
  }
}

Function Check-Files($h) {
  return $h.GetEnumerator() | ForEach-Object {
    $dst = Unresolve-Path $_.Value.target
    $dst_changed = $false
    if(Test-Path $dst -PathType Container) {
      $dst_changed = $true
      $dst = Join-Path $dst $_.Value.src_basename
    }
    New-Object psobject -Property @{
      chk_exists = ($exists = Test-Path $dst -PathType Leaf)
      src_sha1 = ($sMd5 = $_.Key)
      dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
      chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
      verifies = if ($dirty -eq $false) { $true } else { $false }
      target_is_folder = $dst_changed
    }
  } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
}

Function Get-SHA1Sum($src) {
  Try {
    $c = [System.Security.Cryptography.SHA1]::Create()
    $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
    return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
  } 
  Finally {
    Cleanup $c
    Cleanup $in
  }
}

Function Unresolve-Path($path) {
  if ($path -eq $null) {
    return $null
  }
  else {
    return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
  }
}

Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: A05D4BD1-1405-4B7B-88D9-CC023CBB7E3D
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: A05D4BD1-1405-4B7B-88D9-CC023CBB7E3D on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: A05D4BD1-1405-4B7B-88D9-CC023CBB7E3D on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: Parsing CSV Response
[2023-01-23T20:05:39+01:00] DEBUG: "chk_exists","src_sha1","dst_sha1","chk_dirty","verifies","target_is_folder"
"False","d106206d66105aee23402bc113acf660240ec3ad",,"True","False","False"

[2023-01-23T20:05:39+01:00] DEBUG: Uploading /home/pavel/.chef/trusted_certs/redhat.windomain.pavel.crt to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat.windomain.pavel.crt
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for             $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat.windomain.pavel.crt")
            $parent = Split-Path $to
            if(!(Test-path $parent)) { mkdir $parent | Out-Null }
            $fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
                $to,
                [system.io.filemode]::Create,
                [System.io.FileAccess]::Write,
                [System.IO.FileShare]::ReadWrite
            )
            # Powershell caches ScrpitBlocks in a dictionary
            # keyed on the script block text. Thats just great
            # unless the script is super large and called a gillion
            # times like we might do. In such a case it will saturate the
            # Large Object Heap and lead to Out Of Memory exceptions
            # for large files or folders. So we call the internal method
            # ClearScriptBlockCache to clear it.
            $bindingFlags= [Reflection.BindingFlags] "NonPublic,Static"
            $method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: E1550141-E2C6-429B-88AE-74EE581032F2
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: E1550141-E2C6-429B-88AE-74EE581032F2 on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: E1550141-E2C6-429B-88AE-74EE581032F2 on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for             if($method) { $method.Invoke($Null, $Null) }
            $bytes=[Convert]::FromBase64String('LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVKakNDQXc2Z0F3SUJBZ0lWQVBoaFUwNWlUZzFNNm1rbmtER1JpU084MlliL01BMEdDU3FHU0liM0RRRUIKQ3dVQU1GVXhDekFKQmdOVkJBWVRBbFZUTVJBd0RnWURWUVFLREFkWmIzVkRiM0p3TVJNd0VRWURWUVFMREFwUApjR1Z5WVhScGIyNXpNUjh3SFFZRFZRUUREQlp5WldSb1lYUXVkMmx1Wkc5dFlXbHVMbkJoZG1Wc01CNFhEVEl4Ck1EWXhNREV5TWprME1Wb1hEVE14TURZd09ERXlNamswTVZvd1ZURUxNQWtHQTFVRUJoTUNWVk14RURBT0JnTlYKQkFvTUIxbHZkVU52Y25BeEV6QVJCZ05WQkFzTUNrOXdaWEpoZEdsdmJuTXhIekFkQmdOVkJBTU1GbkpsWkdoaApkQzUzYVc1a2IyMWhhVzR1Y0dGMlpXd3dnZ0VpTUEwR0NTcUdTSWIzRFFFQkFRVUFBNElCRHdBd2dnRUtBb0lCCkFRQ3JocThxZmpqRFlQNDJqUjhPVGh6S0dxeUtHOEdmVmdYMXdXY3lnU3N4RGd6enlRaEsyd2hlWjgvSVB3d3UKZi9wbjdMdVc2QmNuemdMR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valRIc3l2S2czQXlEa2FGQVp1WS9KcjJxczFZU2hGSlo4Qgo0WnloYnM1Y25XUWtEVlcvZklzNnhoUkZOeHVET1Y0eDdhMm9qdDNIT3IzeURHUVVpcGZEV043WkxlUjVjQ3E2CkRSbGZJaVlBM0RSSGYyM3Nha3hQU0dhVjlUT0VpZkZ5UWRvN3JscEQrb2xEQlVRSk9LaXcyQmtIWDNXa1UrUVUKamlJVm1CV1FKRHoyYWc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==')
            $fileStream.Write($bytes, 0, $bytes.length)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 159A609B-9326-4DF5-8FB4-B0569B64E84A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: 159A609B-9326-4DF5-8FB4-B0569B64E84A on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: 159A609B-9326-4DF5-8FB4-B0569B64E84A on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for $fileStream.Dispose()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 14DC9B5A-58B4-4439-B51F-7BD2BA7FEF74
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: 14DC9B5A-58B4-4439-B51F-7BD2BA7FEF74 on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: 14DC9B5A-58B4-4439-B51F-7BD2BA7FEF74 on shell_id 07D8389D-89E3-4B34-80A8-6DE6AAA5319A
[2023-01-23T20:05:39+01:00] DEBUG: Finished uploading /home/pavel/.chef/trusted_certs/redhat.windomain.pavel.crt to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat.windomain.pavel.crt (2.0 KB over 1 chunks) in (0m0.08s)
[2023-01-23T20:05:39+01:00] DEBUG: No remote files to extract, skipping
[2023-01-23T20:05:39+01:00] DEBUG: Uploaded 1 items dirty_check: (0m0.29s) stream_files: (0m0.08s) extract: (0m0.00s) 
[2023-01-23T20:05:39+01:00] DEBUG: creating hash for file C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat_windomain_pavel.crt
[2023-01-23T20:05:39+01:00] DEBUG: Running check_files.ps1
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] opening remote shell on http://winserver20225.windomain.pavel:5985/wsman
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e842d950 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Version N=\"protocolversion\">2.3</Version><Version N=\"PSVersion\">2.0</Version><Version N=\"SerializationVersion\">1.1.0.1</Version></MS></Obj>", @destination=1, @type=65538, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e842ca28 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><Obj N=\"ApplicationPrivateData\" RefId=\"1\"><TN RefId=\"0\"><T>System.Management.Automation.PSPrimitiveDictionary</T><T>System.Collections.Hashtable</T><T>System.Object</T></TN><DCT><En><S N=\"Key\">BreakAll</S><B N=\"Value\">false</B></En><En><S N=\"Key\">DebugStop</S><B N=\"Value\">false</B></En><En><S N=\"Key\">UnhandledBreakpointMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">PSVersionTable</S><Obj N=\"Value\" RefId=\"2\"><TNRef RefId=\"0\" /><DCT><En><S N=\"Key\">PSVersion</S><Version N=\"Value\">5.1.20348.1366</Version></En><En><S N=\"Key\">PSEdition</S><S N=\"Value\">Desktop</S></En><En><S N=\"Key\">PSCompatibleVersions</S><Obj N=\"Value\" RefId=\"3\"><TN RefId=\"1\"><T>System.Version[]</T><T>System.Array</T><T>System.Object</T></TN><LST><Version>1.0</Version><Version>2.0</Version><Version>3.0</Version><Version>4.0</Version><Version>5.0</Version><Version>5.1.20348.1366</Version></LST></Obj></En><En><S N=\"Key\">CLRVersion</S><Version N=\"Value\">4.0.30319.42000</Version></En><En><S N=\"Key\">BuildVersion</S><Version N=\"Value\">10.0.20348.1366</Version></En><En><S N=\"Key\">WSManStackVersion</S><Version N=\"Value\">3.0</Version></En><En><S N=\"Key\">PSRemotingProtocolVersion</S><Version N=\"Value\">2.3</Version></En><En><S N=\"Key\">SerializationVersion</S><Version N=\"Value\">1.1.0.1</Version></En></DCT></Obj></En><En><S N=\"Key\">DebugMode</S><I32 N=\"Value\">1</I32></En><En><S N=\"Key\">DebugBreakpointCount</S><I32 N=\"Value\">0</I32></En></DCT></Obj></MS></Obj>", @destination=1, @type=135177, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] polling for pipeline state. message: #<WinRM::PSRP::Message:0x00007fd5e84fa518 @data="\xEF\xBB\xBF<Obj RefId=\"0\"><MS><I32 N=\"RunspaceState\">2</I32></MS></Obj>", @destination=1, @type=135173, @pipeline_id="00000000-0000-0000-0000-000000000000", @runspace_pool_id="00000000-0000-0000-0000-000000000000">
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] remote shell created with shell_id: EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for $hash_file = @{
  "d106206d66105aee23402bc113acf660240ec3ad" = @{
    "target" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat_windomain_pavel.crt";
    "src_basename" = "redhat_windomain_pavel.crt";
    "dst" = "C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat_windomain_pavel.crt"
  }
}

Function Cleanup($disposable) {
  if (($disposable -ne $null) -and ($disposable.GetType().GetMethod("Dispose") -ne $null)) {
    $disposable.Dispose()
  }
}

Function Check-Files($h) {
  return $h.GetEnumerator() | ForEach-Object {
    $dst = Unresolve-Path $_.Value.target
    $dst_changed = $false
    if(Test-Path $dst -PathType Container) {
      $dst_changed = $true
      $dst = Join-Path $dst $_.Value.src_basename
    }
    New-Object psobject -Property @{
      chk_exists = ($exists = Test-Path $dst -PathType Leaf)
      src_sha1 = ($sMd5 = $_.Key)
      dst_sha1 = ($dMd5 = if ($exists) { Get-SHA1Sum $dst } else { $null })
      chk_dirty = ($dirty = if ($sMd5 -ne $dMd5) { $true } else { $false })
      verifies = if ($dirty -eq $false) { $true } else { $false }
      target_is_folder = $dst_changed
    }
  } | Select-Object -Property chk_exists,src_sha1,dst_sha1,chk_dirty,verifies,target_is_folder
}

Function Get-SHA1Sum($src) {
  Try {
    $c = [System.Security.Cryptography.SHA1]::Create()
    $bytes = $c.ComputeHash(($in = (Get-Item $src).OpenRead()))
    return ([System.BitConverter]::ToString($bytes)).Replace("-", "").ToLower()
  } 
  Finally {
    Cleanup $c
    Cleanup $in
  }
}

Function Unresolve-Path($path) {
  if ($path -eq $null) {
    return $null
  }
  else {
    return $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($path)
  }
}

Check-Files $hash_file | ConvertTo-Csv -NoTypeInformation

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 599D20E2-8FAC-42C8-B695-E4300A2467EE
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: 599D20E2-8FAC-42C8-B695-E4300A2467EE on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: 599D20E2-8FAC-42C8-B695-E4300A2467EE on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: Parsing CSV Response
[2023-01-23T20:05:39+01:00] DEBUG: "chk_exists","src_sha1","dst_sha1","chk_dirty","verifies","target_is_folder"
"False","d106206d66105aee23402bc113acf660240ec3ad",,"True","False","False"

[2023-01-23T20:05:39+01:00] DEBUG: Uploading /home/pavel/.chef/trusted_certs/redhat_windomain_pavel.crt to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat_windomain_pavel.crt
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for             $to = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath("C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat_windomain_pavel.crt")
            $parent = Split-Path $to
            if(!(Test-path $parent)) { mkdir $parent | Out-Null }
            $fileStream = New-Object -TypeName System.IO.FileStream -ArgumentList @(
                $to,
                [system.io.filemode]::Create,
                [System.io.FileAccess]::Write,
                [System.IO.FileShare]::ReadWrite
            )
            # Powershell caches ScrpitBlocks in a dictionary
            # keyed on the script block text. Thats just great
            # unless the script is super large and called a gillion
            # times like we might do. In such a case it will saturate the
            # Large Object Heap and lead to Out Of Memory exceptions
            # for large files or folders. So we call the internal method
            # ClearScriptBlockCache to clear it.
            $bindingFlags= [Reflection.BindingFlags] "NonPublic,Static"
            $method = [scriptblock].GetMethod("ClearScriptBlockCache", $bindingFlags)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 3B25159F-5273-4FEC-A56E-3B2CA423965C
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: 3B25159F-5273-4FEC-A56E-3B2CA423965C on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: 3B25159F-5273-4FEC-A56E-3B2CA423965C on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for             if($method) { $method.Invoke($Null, $Null) }
            $bytes=[Convert]::FromBase64String('LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUVKakNDQXc2Z0F3SUJBZ0lWQVBoaFUwNWlUZzFNNm1rbmtER1JpU084MlliL01BMEdDU3FHU0liM0RRRUIKQ3dVQU1GVXhDekFKQmdOVkJBWVRBbFZUTVJBd0RnWURWUVFLREFkWmIzVkRiM0p3TVJNd0VRWURWUVFMREFwUApjR1Z5WVhScGIyNXpNUjh3SFFZRFZRUUREQlp5WldSb1lYUXVkMmx1Wkc5dFlXbHVMbkJoZG1Wc01CNFhEVEl4Ck1EWXhNREV5TWprME1Wb1hEVE14TURZd09ERXlNamswTVZvd1ZURUxNQWtHQTFVRUJoTUNWVk14RURBT0JnTlYKQkFvTUIxbHZkVU52Y25BeEV6QVJCZ05WQkFzTUNrOXdaWEpoZEdsdmJuTX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0FRRUFOblI0UFgrZwpMSU1FbzBOcDZyUEo0bW1LWS9uT3BuZEpVQzBCbUd0YitORXVvTE95cndlWGRyTWFDT3o0am9neFFZWXdsT2V2CkYxYzYvWFJlQVZINnZaSlhUcHN6M1FHSGlIbUVnVVFHNmJXODdDYmtSbFBkcld3NHFnSGZNOSs0RG1sU1VHMTUKNU1BTE5IYjFRb0dlVFZXVEt6RW1aR3QreW1GWVMvalRIc3l2S2czQXlEa2FGQVp1WS9KcjJxczFZU2hGSlo4Qgo0WnloYnM1Y25XUWtEVlcvZklzNnhoUkZOeHVET1Y0eDdhMm9qdDNIT3IzeURHUVVpcGZEV043WkxlUjVjQ3E2CkRSbGZJaVlBM0RSSGYyM3Nha3hQU0dhVjlUT0VpZkZ5UWRvN3JscEQrb2xEQlVRSk9LaXcyQmtIWDNXa1UrUVUKamlJVm1CV1FKRHoyYWc9PQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==')
            $fileStream.Write($bytes, 0, $bytes.length)

if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: BBAA5275-A2BE-4BF7-AFE5-915E79F20ED9
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: BBAA5275-A2BE-4BF7-AFE5-915E79F20ED9 on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: BBAA5275-A2BE-4BF7-AFE5-915E79F20ED9 on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for $fileStream.Dispose()
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 6B7E0D18-92F5-4438-B6C0-DB1D1F88B000
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: 6B7E0D18-92F5-4438-B6C0-DB1D1F88B000 on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: 6B7E0D18-92F5-4438-B6C0-DB1D1F88B000 on shell_id EEE274CA-DB03-47C8-BBFE-EF7089AEC992
[2023-01-23T20:05:39+01:00] DEBUG: Finished uploading /home/pavel/.chef/trusted_certs/redhat_windomain_pavel.crt to C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/trusted_certs/redhat_windomain_pavel.crt (2.0 KB over 1 chunks) in (0m0.08s)
[2023-01-23T20:05:39+01:00] DEBUG: No remote files to extract, skipping
[2023-01-23T20:05:39+01:00] DEBUG: Uploaded 1 items dirty_check: (0m0.27s) stream_files: (0m0.08s) extract: (0m0.00s) 
[2023-01-23T20:05:39+01:00] DEBUG: [ChefApply::Action::ConvergeTarget] Action: running_chef, Action Data: []
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (Set-Location -Path C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7; chef-client -z --config C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb --recipe-url C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz | Out-Null; Set-Location C:/; exit $LASTEXITCODE)
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for Set-Location -Path C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7; chef-client -z --config C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/workstation.rb --recipe-url C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7/windows_install_MSSQL_powershell_DSC-7b0d8f449821060764f52dd2719f69b8b4d3c53332d6ded1f83c4119c1aa024d.tgz | Out-Null; Set-Location C:/; exit $LASTEXITCODE
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: A3DFB928-10F0-48F6-B1F3-350C4BA1374D
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: A3DFB928-10F0-48F6-B1F3-350C4BA1374D on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: A3DFB928-10F0-48F6-B1F3-350C4BA1374D on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] @winserver20225.windomain.pavel<{:transport=>:negotiate, :disable_sspi=>false, :basic_auth_only=>false, :endpoint=>"http://winserver20225.windomain.pavel:5985/wsman", :user=>"[email protected]", :password=>"<hidden>", :no_ssl_peer_verification=>false, :realm=>nil, :service=>nil, :ca_trust_file=>nil, :ssl_peer_fingerprint=>nil, :client_cert=>nil, :client_key=>nil, :key_pass=>nil}> (Remove-Item -Recurse -Force –Path C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7)
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Command created for Remove-Item -Recurse -Force –Path C:/Users/administrator.WINDOMAIN/AppData/Local/Temp/7e4f95e5-85c3-424d-814b-4553cd431cd7
if (!$?) { if($LASTEXITCODE) { exit $LASTEXITCODE } else { exit 1 } } with id: 4A906846-600F-49E0-B3CB-7E64610AD72C
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] creating command_id: 4A906846-600F-49E0-B3CB-7E64610AD72C on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Waiting for output...
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] Processing output
[2023-01-23T20:05:39+01:00] DEBUG: [WinRM] cleaning up command_id: 4A906846-600F-49E0-B3CB-7E64610AD72C on shell_id 87D670DE-A4B8-4378-BB4B-9B468E4AB9B1
[2023-01-23T20:05:39+01:00] INFO: 
[2023-01-23T20:05:39+01:00] DEBUG: [ChefApply::Action::ConvergeTarget] Action: success, Action Data: []

@pvlbrbc pvlbrbc changed the title Resources not working when using chef-run on windows? Resources not working when using chef-run on windows? 22.12.1024 Jan 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Untriaged An issue that has yet to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant