I have managed to properly confuse myself well and truly!
Scenario: Basic Chef installation, server is Ubuntu 12.04, client is windows 2012 server.
What I want to do: Read the “version” property of a file into an attribute of a node.
What I’ve tried: You can see my attempt below. It seems that the PowerShellOut “mixin” is not available, but I’m too scared to add the windows and powershell cookbooks to my collection, because I understand that they are already included in the latest chef. So now I’m stuck! Help!!!
The powershell code below runs and creates the text file fine, but how do I get the value from the text file into the attribute?
powershell_script ‘filever’ do
[System.Diagnostics.FileVersionInfo]::GetVersionInfo(“C:\Program Files\Internet Explorer\iexplore.exe”).FileVersion > C:\windows\temp\fileversion.txt
get-content -Path C:\windows\temp\fileversion.txt
powershell_script ‘filever2’ do
node.normal[:ixserver][:Hello] = powershell_out(“echo hello”)
I’m hoping you guys can help…