Skip to content

Instantly share code, notes, and snippets.

@heyvoon
Last active August 29, 2015 14:21
Discover_JavaAutoupdateIsOn.ps1
<#
This script will check if automatic updates is disabled and return a Compliant/Non-Compliant string.
Name: Discover_JavaAutoupdateIsOn.ps1
Created: 16/05/2015
Version: 1.0
Author: Teksoporte.es
Homepage: http://blog.teksoporte.es
#>
$OSArchitecture = Get-WmiObject -Class Win32_OperatingSystem | Select-Object OSArchitecture
If($OSArchitecture.OSArchitecture -ne “32-bit”)
{
If(Test-Path ‘HKLM:\SOFTWARE\Wow6432Node\Javasoft\Java Update\Policy’)
{
$UpdateCheck = Get-ItemProperty ‘HKLM:\SOFTWARE\Wow6432Node\Javasoft\Java Update\Policy’ -Name EnableAutoUpdateCheck, EnableJavaUpdate, NotifyDownload, NotifyInstall
if (($UpdateCheck.EnableAutoUpdateCheck –eq 0) –and ($UpdateCheck.EnableJavaUpdate -eq 0) –and ($UpdateCheck.NotifyDownload -eq 0) -and ($UpdateCheck.NotifyInstall -eq 0))
{Write-Host ‘Compliant’}
else
{Write-Host ‘Non-Compliant’}
}
else
{Write-Host ‘Non-Compliant’}
}
else
{
If(Test-Path ‘HKLM:\SOFTWARE\JavaSoft\Java Update\Policy’)
{
$UpdateCheck = Get-ItemProperty ‘HKLM:\SOFTWARE\JavaSoft\Java Update\Policy’ -Name EnableAutoUpdateCheck, EnableJavaUpdate, NotifyDownload, NotifyInstall
if (($UpdateCheck.EnableAutoUpdateCheck –eq 0) –and ($UpdateCheck.EnableJavaUpdate -eq 0) –and ($UpdateCheck.NotifyDownload -eq 0) -and ($UpdateCheck.NotifyInstall -eq 0))
{Write-Host ‘Compliant’}
else
{Write-Host ‘Non-Compliant’}
}
else
{Write-Host ‘Non-Compliant’}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment