instance = node[‘test’][‘instance_name’]
$value = 1433
powershell_script “power” do
code <<-EOH
$i = ‘false’
$num = 1433
while ($i -eq ‘false’){
$a = $num
$i=TNC -ComputerName $env:computername -Port $num -InformationLevel Quiet
$num -=1;
}
EOH
$value = $a
end
ruby_block “port_number” do
block do
$value = Chef::Util::FileEdit.new(“C:\script\Summary.txt”)
#file = File.open(“C:\script\Summary.txt”, “rb”)
#contents = file.read
#node.set[‘test’][‘port’] = "#{contents}"
end
end
case $value
when 1433