This repository has been archived on 2023-05-21. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
SysTools/ManagmentTools/RunUpdates.ps1
2021-07-15 15:28:03 +02:00

28 lines
1.4 KiB
PowerShell

######################################################################
# @description: #
# Used for running updates for Chocolatry apps and Windows Updates #
# When the system is all-ready deployed #
# #
# @project: IMGSystTools #
# @author: Bram Prieshof #
######################################################################
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList " Set-ExecutionPolicy -Scope Process Unrestricted -Force; $CommandLine"
Exit
}
}
Write-Output "Checking Chocolatey package updates"
choco upgrade -y all
Write-Output " Chocolatey updates [OK]"
Write-Output "Checking Windows updates"
Import-Module PSWindowsUpdate
Get-WUInstall -MicrosoftUpdate -AcceptAll -Install
Write-Output " Windows updates [OK]"
#Removing Created Shortcuts
Remove-Item C:\Users\Public\Desktop\*.lnk