mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-05-12 13:27:23 +00:00
Merge pull request #10010 from Karl-WE/patch-7
Update script to ensure PowerShell 7 compatibility
This commit is contained in:
commit
81b363238a
@ -22,6 +22,7 @@ ms.reviewer:
|
|||||||
- Windows 11
|
- Windows 11
|
||||||
- Windows Server 2016
|
- Windows Server 2016
|
||||||
- Windows Server 2019
|
- Windows Server 2019
|
||||||
|
- Windows Server 2022
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
# Script to find out if a machine is Device Guard compliant.
|
# Script to find out if a machine is Device Guard compliant.
|
||||||
@ -780,7 +781,7 @@ function CheckOSSKU
|
|||||||
|
|
||||||
function CheckOSArchitecture
|
function CheckOSArchitecture
|
||||||
{
|
{
|
||||||
$OSArch = $(gwmi win32_operatingsystem).OSArchitecture.ToLower()
|
$OSArch = $(Get-WmiObject win32_operatingsystem).OSArchitecture.ToLower()
|
||||||
Log $OSArch
|
Log $OSArch
|
||||||
if($OSArch -match ("^64\-?\s?bit"))
|
if($OSArch -match ("^64\-?\s?bit"))
|
||||||
{
|
{
|
||||||
@ -818,9 +819,9 @@ function CheckSecureBootState
|
|||||||
|
|
||||||
function CheckVirtualization
|
function CheckVirtualization
|
||||||
{
|
{
|
||||||
$_vmmExtension = $(gwmi -Class Win32_processor).VMMonitorModeExtensions
|
$_vmmExtension = $(Get-WMIObject -Class Win32_processor).VMMonitorModeExtensions
|
||||||
$_vmFirmwareExtension = $(gwmi -Class Win32_processor).VirtualizationFirmwareEnabled
|
$_vmFirmwareExtension = $(Get-WMIObject -Class Win32_processor).VirtualizationFirmwareEnabled
|
||||||
$_vmHyperVPresent = (gcim -Class Win32_ComputerSystem).HypervisorPresent
|
$_vmHyperVPresent = (Get-CimInstance -Class Win32_ComputerSystem).HypervisorPresent
|
||||||
Log "VMMonitorModeExtensions $_vmmExtension"
|
Log "VMMonitorModeExtensions $_vmmExtension"
|
||||||
Log "VirtualizationFirmwareEnabled $_vmFirmwareExtension"
|
Log "VirtualizationFirmwareEnabled $_vmFirmwareExtension"
|
||||||
Log "HyperVisorPresent $_vmHyperVPresent"
|
Log "HyperVisorPresent $_vmHyperVPresent"
|
||||||
@ -1046,7 +1047,7 @@ if(!$TestForAdmin)
|
|||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
|
|
||||||
$isRunningOnVM = (get-wmiobject win32_computersystem).model
|
$isRunningOnVM = (Get-WmiObject win32_computersystem).model
|
||||||
if($isRunningOnVM.Contains("Virtual"))
|
if($isRunningOnVM.Contains("Virtual"))
|
||||||
{
|
{
|
||||||
LogAndConsoleWarning "Running on a Virtual Machine. DG/CG is supported only if both guest VM and host machine are running with Windows 10, version 1703 or later with English localization."
|
LogAndConsoleWarning "Running on a Virtual Machine. DG/CG is supported only if both guest VM and host machine are running with Windows 10, version 1703 or later with English localization."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user