Quicktime SMS / SCCM update / install deploy

Description soon

# Upgrade Apple Quick time / Remove the old programs
# Log created during run: %temp%\QuicktimeUpdater.log
# To get the quicktime msi: QuickTimeInstaller.exe /extract
$64bitlevel=$true
if ((gwmi win32_computersystem).SystemType -like "*X86*") {#if1
$64bitlevel=$false
}#if1
#uninstall the apple update software
try{
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
$myresult = Get-WmiObject -Class Win32_Product | Where-Object -FilterScript { ($_.Name -like "*Apple*") -and ($_.Name -like "*Supp*")}
if ($myresult -ne $null) {
$myresult | foreach {
$retcode = $_.Uninstall()
$myexitcode = $retcode.ReturnValue
$thisstr = "Machine: " + $mymachine + " Return Code: " + $myexitcode
$thisstr | out-file ($mytemp + "\QuicktimeUpdater.log") -append -noclobber
} #end foreach
} #end if Null
} #End try
catch {
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
$thisstr = "Machine: " + $mymachine + " Time: " + (Get-Date) + " Error: " + $_
$thisstr | out-file ($mytemp + "\QuicktimeUpdater.log") -append -noclobber
#exit fail
exit 1
} #end Catch
#uninstall the apple quicktime software
try{
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
$myresult = Get-WmiObject -Class Win32_Product | Where-Object -FilterScript {($_.Name -like "*quicktime*")}
if ($myresult -ne $null) {
$myresult | foreach {
$retcode = $_.Uninstall()
$myexitcode = $retcode.ReturnValue
$thisstr = "Machine: " + $mymachine + " Return Code: " + $myexitcode
$thisstr | out-file ($mytemp + "\QuicktimeUpdater.log") -append -noclobber
} #end foreach
} #end if Null
} #End try
catch {
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
$thisstr = "Machine: " + $mymachine + " Time: " + (Get-Date) + " Error: " + $_
$thisstr | out-file ($mytemp + "\QuicktimeUpdater.log") -append -noclobber
#exit fail
exit 1
} #end Catch
$mymachine = get-content env:computername
$mytemp = get-content env:TEMP
#Update / install Quick time
Start-Process -wait -filepath msiexec -ArgumentList '/i QuickTime.msi /quiet /norestart ALLUSERS=1 DESKTOP_SHORTCUTS=0 SCHEDULE_ASUW=0' -ErrorVariable $myexitcode
if ( $myexitcode -eq 0 ) {
$thisstr = "Machine: " + $mymachine + " Time: " + (Get-Date) + " NOTE: Quicktime Installed"
$thisstr | out-file ($mytemp + "\QuicktimeUpdater.log") -append -noclobber
} else {
$thisstr = "Machine: " + $mymachine + " Time: " + (Get-Date) + " ERROR: Quicktime Install FAILED code " + $myexitcode
$thisstr | out-file ($mytemp + "\QuicktimeUpdater.log") -append -noclobber
exit 1
}
#Nuke apple icons and registry settings
if ( $64bitlevel ) {#64 bit
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run' -Name 'QuickTime Task' -ErrorAction Continue
if ( Test-Path -Path 'C:\Users\Public\Desktop\QuickTime Player.lnk' ) {
Remove-Item -Path 'C:\Users\Public\Desktop\QuickTime Player.lnk'
}
}
else {#32 bit
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Run' -Name 'QuickTime Task' -ErrorAction Continue
if ( Test-Path -Path 'C:\Users\Public\Desktop\QuickTime Player.lnk' ) {
Remove-Item -Path 'C:\Users\Public\Desktop\QuickTime Player.lnk'
}
#for xp
if (Test-Path -Path ($env:ALLUSERSPROFILE + '\Desktop\QuickTime Player.lnk') ){
Remove-Item -Path ($env:ALLUSERSPROFILE + '\Desktop\QuickTime Player.lnk')
}
}
exit 0