Public/Set-AdobeUpdater.ps1
Function Set-AdobeUpdater { <# .SYNOPSIS Enable or Disable Automatic Update for Adobe Reader DC .DESCRIPTION Enable or Disable Automatic Update for Adobe Reader DC .PARAMETER Status Enable or Disable Automatic Update, valid options are 0 or 1 .EXAMPLE Set-AdobeUpdater -Status 0 Disable Automatic Update, valid options are 0 or 1 .INPUTS System.Int .LINK about_functions_advanced .LINK about_CommonParameters #> [CmdletBinding( ConfirmImpact = 'Medium', SupportsShouldProcess = $true )] [OutputType('None')] Param( [Parameter( Mandatory = $true, ValueFromPipeline = $true, HelpMessage = "Enable or Disable Automatic Update, valid options are 0 or 1" )] [ValidateRange(0, 1)] [ValidateNotNullOrEmpty()] [int]$Status ) Begin { If (-not $PSBoundParameters.ContainsKey('Confirm')) { $ConfirmPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ConfirmPreference') } If (-not $PSBoundParameters.ContainsKey('Verbose')) { $VerbosePreference = $PSCmdlet.SessionState.PSVariable.GetValue('VerbosePreference') } If (-not $PSBoundParameters.ContainsKey('ErrorAction')) { $ErrorActionPreference = $PSCmdlet.SessionState.PSVariable.GetValue('ErrorActionPreference') } Switch ($Status) { 0 { $Line = "Disable Update Feature" } 1 { $Line = "Enable Update Feature" } } } Process { If ($PSCmdlet.ShouldProcess("Acrobat Reader DC", $Line)) { Set-ItemProperty 'HKLM:\SOFTWARE\Policies\Adobe\Acrobat Reader\DC\FeatureLockDown' -Name bUpdater -Value $Status If ($Status -eq 0) { If ($PSVersionTable.PSVersion.Major -ge 5) { Get-ScheduledTask -TaskName "Adobe Acrobat Update Task" | Disable-ScheduledTask | Out-Null } Else { schtasks /change /disable /TN "Adobe Acrobat Update Task" | Out-Null } Get-Service -Name AdobeARMservice | Stop-Service Set-Service -Name AdobeARMservice -StartupType Disabled } If ($Status -eq 1) { If ($PSVersionTable.PSVersion.Major -ge 5) { Get-ScheduledTask -TaskName "Adobe Acrobat Update Task" | Enable-ScheduledTask | Out-Null } Else { schtasks /change /enable /TN "Adobe Acrobat Update Task" | Out-Null } Set-Service -Name AdobeARMservice -StartupType Automatic Get-Service -Name AdobeARMservice | Start-Service } } } End { } } |