Skip to content

Commit

Permalink
Update WINspect.ps1
Browse files Browse the repository at this point in the history
issue with securitycenter namespace
  • Loading branch information
Spartacus committed Mar 9, 2018
1 parent 110a379 commit b6e69ff
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions WINspect.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,6 @@ function initialize-audit {

}


function get-LocalSecurityProducts
{
<#
Expand Down Expand Up @@ -254,12 +253,20 @@ function get-LocalSecurityProducts

}

$securityCenterNS="root\SecurityCenter"

[System.Version]$OSVersion=(Get-WmiObject -class Win32_operatingsystem).Version

if($OSVersion -gt [System.Version]'6.0.0.0'){$SecurityCenterNS+="2"}




if(Get-WmiObject -Namespace root -class __NAMESPACE -filter "name='SecurityCenter2'"){

$securityCenterNS="root\SecurityCenter2"

}else{

$securityCenterNS="root\SecurityCenter"
}



# checks for third party firewall products

Write-host "`n[?] Checking for third party Firewall products .. `n" -ForegroundColor Black -BackgroundColor White
Expand Down Expand Up @@ -329,9 +336,9 @@ function get-LocalSecurityProducts
$antivirus|%{
if($securityCenterNS.endswith("2")){

[int]$productState=$_.ProductState
[int]$productState=$_.ProductState

$hexString=[System.Convert]::toString($productState,16).padleft(6,'0')
$hexString=[System.Convert]::toString($productState,16).padleft(6,'0')

$provider=$hexString.substring(0,2)

Expand Down Expand Up @@ -375,11 +382,11 @@ function get-LocalSecurityProducts

$antispyware| % {

if($securityCenterNS.endswith("2")){
if($securityCenterNS.endswith("2")){

[int]$productState=$_.ProductState

$hexString=[System.Convert]::toString($productState,16).padleft(6,'0')
$hexString=[System.Convert]::toString($productState,16).padleft(6,'0')

$provider=$hexString.substring(0,2)

Expand Down

0 comments on commit b6e69ff

Please sign in to comment.