Skip to content

Instantly share code, notes, and snippets.

@chris-rock
Created April 9, 2017 19:59
Show Gist options
  • Save chris-rock/3ab57d7d1bb3d1b813f614f81dcfafbf to your computer and use it in GitHub Desktop.
Save chris-rock/3ab57d7d1bb3d1b813f614f81dcfafbf to your computer and use it in GitHub Desktop.
Windows Operating System Checks
# Author: Christoph Hartmann
# Target OS: Windows 2012+
describe file('C:/Windows/explorer.exe') do
it { should exist }
it { should be_file }
end
describe user('Administrator') do
it { should exist }
end
# look for all administrators: SID: S-1-5-21domain-500
describe users.where { uid =~ /S\-1\-5\-21\-\d+\-\d+\-\d+\-500/ } do
it { should exist }
end
## package example
describe package('InSpec v1.19.2') do
it { should be_installed }
its('version') { should eq '1.19.2.1' }
end
describe windows_task('\Microsoft\Windows\AppID\PolicyConverter') do
it { should exist }
it { should be_disabled }
its('logon_mode') { should eq 'Interactive/Background' }
its('last_result') { should cmp 267011 }
its('task_to_run') { should cmp '%Windir%\system32\appidpolicyconverter.exe' }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment