30 lines
714 B
Ruby
30 lines
714 B
Ruby
|
script = <<-EOH
|
||
|
# Initialize variable to empty array
|
||
|
$LogicalDisks = @()
|
||
|
|
||
|
# Enumerate all logicaldisks
|
||
|
# DriveType:
|
||
|
# Unknown (0)
|
||
|
# No Root Directory (1)
|
||
|
# Removable Disk (2)
|
||
|
# Local Disk (3)
|
||
|
# Network Drive (4)
|
||
|
# Compact Disc (5)
|
||
|
# RAM Disk (6)
|
||
|
$LogicalDisks += Get-WmiObject -Class 'win32_logicaldisk' -Filter 'DriveType=3'
|
||
|
|
||
|
# Filter/Quantify
|
||
|
($LogicalDisks.Count -eq 1) -and (($LogicalDisks | Where-Object {$_.DeviceID -ne 'C:'}).Count -eq 0)
|
||
|
EOH
|
||
|
|
||
|
control "single_disk" do
|
||
|
title 'Single Disk'
|
||
|
desc '
|
||
|
This test assures that only a single disk (C:) is available
|
||
|
'
|
||
|
|
||
|
describe powershell(script) do
|
||
|
its('stdout') { should match 'True' }
|
||
|
end
|
||
|
end
|