Skip to content
This repository has been archived by the owner on Apr 30, 2023. It is now read-only.

Commit

Permalink
Create DetectionRule.ps1
Browse files Browse the repository at this point in the history
  • Loading branch information
ozthe2 authored Oct 8, 2019
1 parent 1811dad commit fe60ebc
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions SCCM/SourceOne/DetectionRule.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
$RegistryKey32 = 'HKLM:\SOFTWARE\WOW6432Node\EMC\SourceOne\Versions'
$RegistryKey64 = 'HKLM:\SOFTWARE\EMC\SourceOne\Versions'
$Value = 'OfflineAccess'
$Data = '7.27.7017'

$OfficePaths = @('HKLM:\Software\Microsoft\Office','HKLM:\Software\WOW6432Node\Microsoft\Office')
$OfficeVersions = @('14.0', '15.0', '16.0')

foreach ($Path in $OfficePaths) {
foreach ($Version in $OfficeVersions) {
try {
Set-Location "$Path\$Version\Outlook" -ea stop -ev x
$Bitness = Get-ItemPropertyValue -Name "Bitness" -ea stop -ev x
switch ($bitness) {
'x86' {$Is32Bit = $True}
'x64' {$Is32Bit = $false}
}
break
} catch {
$Is32Bit = 'Unknown'
}
}
if ($Is32Bit -eq $true -or $Is32Bit -eq $false) {break}
}

if ($Is32Bit) {
if ((Get-ItemProperty -Path $RegistryKey32 | Select-Object $Value -ExpandProperty $Value -ErrorAction SilentlyContinue) -eq $data) {
Write-Host "Detected!"
}
} else {
if ((Get-ItemProperty -Path $RegistryKey64 | Select-Object $Value -ExpandProperty $Value -ErrorAction SilentlyContinue) -eq $data) {
Write-Host "Detected!"
}
}

0 comments on commit fe60ebc

Please sign in to comment.