Forum Discussion
elvys_marchon
Feb 04, 2022Copper Contributor
Help deploy a powershell script to install speculation module
Hi folks, I need help checking the status "Speculation Execution Side-Channel Vulnerabilities". I use the document "https://support.microsoft.com/en-us/topic/understanding-get-speculationcontrol...
elvys_marchon
Feb 16, 2022Copper Contributor
Hi Acreature
I'm using Stop-Transcript, but same issue occur.
If I'm using it locally, the script runs fine, but when it runs through intune it just writes the beginning and nothing else happens.
elvys_marchon
Feb 16, 2022Copper Contributor
The script
#######
Start-Transcript $env:TEMP\saida_speculation.txt
Set-Variable -Name 'ConfirmPreference' -Value 'None' -Scope Global
$SaveExecutionPolicy = Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned -Scope Process -Force -Confirm:$false
try {
$SpeculationControlModule = Get-InstalledModule -Name SpeculationControl -ErrorAction Stop -Verbose:$false
if ($SpeculationControlModule -ne $null) {
$LatestModuleVersion = (Find-Module -Name SpeculationControl -ErrorAction Stop -Verbose:$false).Version
if ($LatestModuleVersion -gt $SpeculationControlModule.Version) {
$UpdateModuleInvocation = Update-Module -Name SpeculationControl -Force -Scope Process -ErrorAction Stop -Confirm:$false
}
}
}
catch [System.Exception] {
try {
$PackageProvider = Install-PackageProvider -Name NuGet -Scope CurrentUser -Confirm:$false
Install-Module -Name SpeculationControl -Force -ErrorAction Stop -Scope CurrentUser -Confirm:$false
}
catch [System.Exception] {
Write-Host "An error occurred while attempting to install SpeculationControl module. Error message: $($_.Exception.Message)" ; break
}
}
Import-Module SpeculationControl
Get-SpeculationControlSettings | Out-File -FilePath $Env:ProgramData\speculationcontrol.txt
Set-ExecutionPolicy $SaveExecutionPolicy -Scope Process -Force -Confirm:$false
exit 0
exit
Stop-Transcript
#######
The output
**********************
Windows PowerShell transcript start
Start time: 20220211184851
Username: AzureAD\xxxx
RunAs User: AzureAD\xxxx
Configuration Name:
Machine: DESKTOP-xxxxxx (Microsoft Windows NT)
Host Application: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -executionPolicy bypass -file C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\ca16a6aa16-2f0d-4x48-80be-8bxf7cca6fbf2_xbc108d02-ac34yy-41c3-a14072-e16b7f2336b1ae.ps1
Process ID: 7176
PSVersion: xxxx
PSEdition: Desktop
PSCompatibleVersions: xxxx
BuildVersion: xxxx
CLRVersion: xxxx
WSManStackVersion: xxxx
PSRemotingProtocolVersion: xxxx
SerializationVersion: xxx
**********************
Transcript started, output file is C:\Users\xxxxxx\AppData\Local\Temp\saida_speculation.txt
Some help?
#######
Start-Transcript $env:TEMP\saida_speculation.txt
Set-Variable -Name 'ConfirmPreference' -Value 'None' -Scope Global
$SaveExecutionPolicy = Get-ExecutionPolicy
Set-ExecutionPolicy RemoteSigned -Scope Process -Force -Confirm:$false
try {
$SpeculationControlModule = Get-InstalledModule -Name SpeculationControl -ErrorAction Stop -Verbose:$false
if ($SpeculationControlModule -ne $null) {
$LatestModuleVersion = (Find-Module -Name SpeculationControl -ErrorAction Stop -Verbose:$false).Version
if ($LatestModuleVersion -gt $SpeculationControlModule.Version) {
$UpdateModuleInvocation = Update-Module -Name SpeculationControl -Force -Scope Process -ErrorAction Stop -Confirm:$false
}
}
}
catch [System.Exception] {
try {
$PackageProvider = Install-PackageProvider -Name NuGet -Scope CurrentUser -Confirm:$false
Install-Module -Name SpeculationControl -Force -ErrorAction Stop -Scope CurrentUser -Confirm:$false
}
catch [System.Exception] {
Write-Host "An error occurred while attempting to install SpeculationControl module. Error message: $($_.Exception.Message)" ; break
}
}
Import-Module SpeculationControl
Get-SpeculationControlSettings | Out-File -FilePath $Env:ProgramData\speculationcontrol.txt
Set-ExecutionPolicy $SaveExecutionPolicy -Scope Process -Force -Confirm:$false
exit 0
exit
Stop-Transcript
#######
The output
**********************
Windows PowerShell transcript start
Start time: 20220211184851
Username: AzureAD\xxxx
RunAs User: AzureAD\xxxx
Configuration Name:
Machine: DESKTOP-xxxxxx (Microsoft Windows NT)
Host Application: C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe -NoProfile -executionPolicy bypass -file C:\Program Files (x86)\Microsoft Intune Management Extension\Policies\Scripts\ca16a6aa16-2f0d-4x48-80be-8bxf7cca6fbf2_xbc108d02-ac34yy-41c3-a14072-e16b7f2336b1ae.ps1
Process ID: 7176
PSVersion: xxxx
PSEdition: Desktop
PSCompatibleVersions: xxxx
BuildVersion: xxxx
CLRVersion: xxxx
WSManStackVersion: xxxx
PSRemotingProtocolVersion: xxxx
SerializationVersion: xxx
**********************
Transcript started, output file is C:\Users\xxxxxx\AppData\Local\Temp\saida_speculation.txt
Some help?