Packer.Images/inspec/Windows10IoTEnterprise/profile/controls/Win10/Disabled Services.rb
djpbessems 08b63f30d6
All checks were successful
continuous-integration/drone/push Build is passing
Delete commit history (containing proprietary code)
2021-01-24 09:26:53 +01:00

30 lines
754 B
Ruby

script = <<-EOH
# Initialize variable to empty array
$NonCompliantServices = @()
# Specify relevant services
$Services = @(
"wuauserv",
"W3SVC",
"XboxGipSvc",
"XblGameSave"
)
# Enumerate all services
$NonCompliantServices += Get-Service $Services -ErrorAction 'SilentlyContinue' | Where-Object {$_.StartType -ne 'Disabled'}
# Output; 'True' or list of noncompliant services
Write-Output ($True, $NonCompliantServices)[!($NonCompliantServices.Count -eq 0)]
EOH
control "disabled_services" do
title 'Disabled services'
desc '
This test assures that all unneeded services are set to "disabled".
'
describe powershell(script) do
its('stdout') { should match 'True' }
end
end