mirror of
https://github.com/PowerShell/PSDscResources
synced 2026-06-21 13:45:29 +00:00
Test-Is NanoServer speed improvement
Replace Get-ComputerInfo with Registry Value Test
This commit is contained in:
@@ -8,23 +8,16 @@ function Test-IsNanoServer
|
||||
[CmdletBinding()]
|
||||
param ()
|
||||
|
||||
$isNanoServer = $false
|
||||
|
||||
if (Test-CommandExists -Name 'Get-ComputerInfo')
|
||||
$ServerLevels = Get-ItemProperty -Path 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels'
|
||||
If ($ServerLevels.NanoServer -eq 1)
|
||||
{
|
||||
$computerInfo = Get-ComputerInfo -ErrorAction 'SilentlyContinue'
|
||||
|
||||
if ($null -ne $computerInfo)
|
||||
{
|
||||
$computerIsServer = 'Server' -ieq $computerInfo.OsProductType
|
||||
|
||||
if ($computerIsServer)
|
||||
{
|
||||
$isNanoServer = 'NanoServer' -ieq $computerInfo.OsServerLevel
|
||||
}
|
||||
}
|
||||
$isNanoServer = $True
|
||||
}
|
||||
|
||||
Else
|
||||
{
|
||||
$isNanoServer = $false
|
||||
}
|
||||
|
||||
return $isNanoServer
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user