Intune Initial Scripts Backup
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
|
||||
Set-PSRepository -Name PSGallery -InstallationPolicy Trusted
|
||||
Install-Module pswindowsupdate
|
||||
Import-Module pswindowsupdate
|
||||
|
||||
$scheduledTaskState = (Get-ScheduledTask -TaskName "PSWindowsUpdate").state
|
||||
|
||||
try {
|
||||
if (((Get-WindowsUpdate -Title "Windows 11, version 23H2").status -eq "-D-----") -and ($scheduledTaskState.value -ne "Ready")) {
|
||||
Write-Host "Update Downloaded but not scheduled"
|
||||
Exit 1
|
||||
}
|
||||
elseif ($scheduledTaskState.value -eq "Ready") {
|
||||
Write-Host "Update Downloaded and Scheduled"
|
||||
Exit 0
|
||||
}
|
||||
Write-Host "Not Compliant"
|
||||
Exit 1
|
||||
}
|
||||
catch {
|
||||
Write-Host "Not Compliant - Catch"
|
||||
Exit 1
|
||||
}
|
||||
Reference in New Issue
Block a user