The reconstructed evaluation script behind this rule's OVAL check(s) — every module a compound check combines, with this rule's own concrete values and DISA's SCC tool's real per-module mechanism curated from static teardown of SCC releases.
# Windows PowerShell
# Reconstructed from oval:mil.disa.stig.windows:def:1042
# The Microsoft FTP service must not be installed unless required.
# Per-module read mechanism curated from static teardown of DISA's SCC tool
# (SCAP Compliance Checker) -- see the SCC Automation Reference above.
# Check to make sure the FTP server role is not present.
# wmi57_object (wmi57_test)
function test_1 {
return (-not ($null -ne (Get-CimInstance -Namespace 'root\cimv2' -Query 'SELECT startmode FROM Win32_Service WHERE name='ftpsvc'')))
}
# Check to make sure the FTP server role is disabled.
# wmi57_object (wmi57_test)
function test_2 {
return (((Get-CimInstance -Namespace 'root\cimv2' -Query 'SELECT startmode FROM Win32_Service WHERE name=''ftpsvc''' | Select-Object -First 1) | Select-Object -ExpandProperty 'startmode') -eq 'Disabled')
}
if ((test_1 -or test_2)) {
Write-Output "PASS"
} else {
Write-Output "FAIL"
} Assessment Script Powered by AISyntax-verified
A standalone PowerShell script to assess this control automatically. Review before running it in your environment.
Syntax-checked as valid PowerShell. Not executed here — running it for real needs the actual ms_windows_server_2016 target this check assesses.
# OVAL Definition: oval:mil.disa.stig.windows:def:1042
$ftpService = Get-CimInstance -ClassName Win32_Service -Filter "Name='ftpsvc'"
if ($ftpService -eq $null)
{
Write-Output "PASS"
Exit 0
}
elseif ($ftpService.State -eq 'Stopped' -and $ftpService.StartMode -eq 'Disabled')
{
Write-Output "PASS"
Exit 0
}
else
{
Write-Output "FAIL"
Exit 1
}