-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathUpdate_Drivers_from_Microsoft_v16_Remediation.ps1
More file actions
31 lines (31 loc) · 3.72 KB
/
Copy pathUpdate_Drivers_from_Microsoft_v16_Remediation.ps1
File metadata and controls
31 lines (31 loc) · 3.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#Created by Pavel Mirochnitchenko MVP.
#Matches any available drivers from Microsoft Update Catalog based on Plug&Play detection. Also updates BIOS if available. Compatible with Intune Autopilot.
#Start logging
Start-Transcript -Path "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Update_v16.log"
#Install prerequisite
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.021 -Force
Install-Module -Name PSWindowsUpdate -Force
Import-Module -Name PSWindowsUpdate -Force
#Register to MS Update Service
Add-WUServiceManager -ServiceID "7971f918-a847-4430-9279-4a52d1efe18d" -Confirm:$false
#Download and install drivers. Multiple times because command might break between driver installs
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part1_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part2_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part3_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part4_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part5_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part6_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part7_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
Install-WindowsUpdate -Install -AcceptAll -UpdateType Driver -MicrosoftUpdate -ForceDownload -ForceInstall -IgnoreReboot -RecurseCycle 4 | Out-File "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Install_from_Microsoft_Catalog_part8_$(Get-date -Format dd-MMM-yyyy-hh.mm.ss).log" -Force -ErrorAction SilentlyContinue
Start-Sleep -s 30
#Create detection method
Add-Content "C:\ProgramData\Microsoft\IntuneManagementExtension\Logs\LABS_Drivers_Update_v16.log" "Drivers update completed" -ErrorAction SilentlyContinue
#Stop logging
Stop-Transcript