10/15/2019 247 views

Problem: Determine remote computers Data Execution Prevention (DEP) status and pipe the results to a txt file including the machine name.

Current Solution: BCDEdit /enum "{current}" | out-file \FILESHARE\DEP\DEP.txt -Append

I'm pushing the script out through SCCM so my only issue is getting the machine name included with the results. SCCM allows you to run the script on each machine remotely as System so I don't have to worry about "get-content" with a list of PC's just point to a collection and run the script on those systems.

Alternatively, I tried to run Powershell command outside of SCCM such as:

$XenServers = get-content -path 'C:\PC_List.txt'

$Results= ForEach ($XenServer in $XenServers) { BCDEdit /enum "{current}" }

$Results | Out-File \FILESHARE\DEP\DEP.txt

0 Comments   [ + ] Show comments


Community Chosen Answer


use wmic

wmic OS Get DataExecutionPrevention_SupportPolicy, csname > \FILESHARE\DEP\DEP.txt

Answered 10/15/2019 by: SMal.tmcc
Red Belt

All Answers


You can try this one:

-join "Computer Name: `t`t $($env:COMPUTERNAME)", $(BCDEDIT /enum "{current}"),$("-"*80) | Out-File \FILESHARE\DEP\DEP.txt -Append
Answered 10/16/2019 by: rad33k
Fourth Degree Brown Belt