Understanding Get-SpeculationControlSettings PowerShell script output


I'm fairly new to Powershell, so I just ran into something that is beyond my current capabilities....

Microsoft has a web page (https://support.microsoft.com/en-us/help/4074629/understanding-the-output-of-get-speculationcontrolsettings-powershell) that provides a Powershell script that will show what aspects of Spectre/Meltdown/MDS a machine in vulnerable to. The script, however, expects to be run interactively.

I tried just sending it to a test machine with Deploy, but it returned the error:

Exception calling "ShouldContinue" with "2" argument(s): "Windows PowerShell is in NonInteractive mode. Read and Prompt functionality is not available." At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\\PSModule.psm1:7455 char:8

  • if($Force -or $psCmdlet.ShouldContinue($shouldContinueQueryMessag ...
  •    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    • CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
    • FullyQualifiedErrorId : PSInvalidOperationException

Has anyone succeeded in converting Microsoft's script into something that Deploy can send, and where we can get meaningful data back?

login to comment

Here's what I did:

# Navigate to the Repository in PowerShell (I'm using the default Repository path).
cd 'C:\users\Public\Documents\Admin Arsenal\PDQ Deploy\Repository'

# Create a "Custom" folder.
# I like to put custom items in here because it's easier to exclude them from the Repository Cleanup.
New-Item -ItemType "Directory" -Name "Custom"
cd '.\Custom'

# Save the SpeculationControl module.
# You'll have to update the version number if it changes.
Save-Module -Name "SpeculationControl" -Path .
cd '.\SpeculationControl\1.0.14'

# Create the script that Deploy will use.
$ScriptText = @'
Import-Module .\SpeculationControl.psd1

Out-File -InputObject $ScriptText -FilePath '.\PDQ Deploy Step.ps1'

Now create a Deploy package with an Install Step pointing to $(Repository)\Custom\SpeculationControl\1.0.14\PDQ Deploy Step.ps1.

Make sure to enable the "Include Entire Directory" checkbox.

login to comment


Thank you, Colby. That worked nicely.
I never would have gotten there myself.

login to comment