On Monday, February 10, 2014 at 1:24 PM, wrote:
Dan,I tried your suggestion like this:script =<<-EOF$processLog = 'C:\\Temp\\Chef_PS_Log.txt'function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }Add-Content $processLog (($date=Date) + ' ' + '----- 1. InsideInstall_IIS_Check ----')$x = Get-WindowsFeature -name "Web-Server"$status = 0if($x -ne $null){$installed = $x.Installedif($installed -eq $false){Add-Content $processLog (($date=Date) + ' ' + 'IIS isnot installed')$status = 1}else{Add-Content $processLog (($date=Date) + ' ' + 'IIS isalready installed. Install_IIS step will be skipped')$status = 0}}Add-Content $processLog "`n"return $statusEOFpowershell_script "Install_IIS" docode <<-EOH$processLog = 'C:\\Temp\\Chef_PS_Log.txt'function Date { Get-Date -Format 'yyyy/dd/MM HH:mm:ss' }Add-Content $processLog (($date=Date) + ' ' + '----- 1-1 InsideInstall_IIS ----')Add-Content $processLog (($date=Date) + ' ' + 'IIS Server role is notinstalled ')#Install-WindowsFeature -name "Web-Server" -IncludeManagementTools-IncludeAllSubFeature -WhatIfInstall-WindowsFeature -name "Web-Server" -IncludeManagementTools-IncludeAllSubFeatureEOHonly_if docmd = powershell_out(script)cmd.stdout.chop == '1'end# { x == '1' }endOn running chef-client I get the following error:NoMethodError-------------undefined method `powershell_out' for Chef::Resource::PowershellScriptAny idea if that is expected?Thanks-Kapil
Archive powered by MHonArc 2.6.16.