Test whether Reboot Required for (Windows Only) using Chef Inspec

82 views Asked by At

I am new to Chef Inspec, I want to test Reboot Required for (Windows Only) using Inspec code. Below is my code:

# Reboot Required Yes for windows  

control 'PowerShellTest' do
  impact 0.1
    title 'Check powershell code inside inspec'
    desc  'TestCase for Powershell'
    if os.family == 'windows'
    describe command(shutdown /r) do
      its('action') { should be 'yes' }
      its('stderr') { should eq '' }
     its('exit_status') { should eq 0 }
  end
end

enter image description here

0

There are 0 answers