Compare commits
2 commits
267e699783
...
4fe9b57b53
Author | SHA1 | Date | |
---|---|---|---|
Manuel Thalmann | 4fe9b57b53 | ||
Manuel Thalmann | e8e5ea61d2 |
|
@ -206,12 +206,6 @@
|
||||||
</SynchronousCommand> -->
|
</SynchronousCommand> -->
|
||||||
<SynchronousCommand wcm:action="add">
|
<SynchronousCommand wcm:action="add">
|
||||||
<Order>1</Order>
|
<Order>1</Order>
|
||||||
<RequiresUserInput>true</RequiresUserInput>
|
|
||||||
<CommandLine>cmd /C wmic useraccount where name="Admin" set PasswordExpires=false</CommandLine>
|
|
||||||
<Description>Password Never Expires</Description>
|
|
||||||
</SynchronousCommand>
|
|
||||||
<SynchronousCommand wcm:action="add">
|
|
||||||
<Order>2</Order>
|
|
||||||
<RequiresUserInput>false</RequiresUserInput>
|
<RequiresUserInput>false</RequiresUserInput>
|
||||||
<CommandLine>powershell -Command "Set-ExecutionPolicy -Force Bypass"</CommandLine>
|
<CommandLine>powershell -Command "Set-ExecutionPolicy -Force Bypass"</CommandLine>
|
||||||
<Description>Allow PowerShell scripts from anywhere.</Description>
|
<Description>Allow PowerShell scripts from anywhere.</Description>
|
||||||
|
|
|
@ -7,12 +7,14 @@ function Update-WindowsInstallation {
|
||||||
Runs the Windows update loop.
|
Runs the Windows update loop.
|
||||||
#>
|
#>
|
||||||
function Start-UpdateLoop {
|
function Start-UpdateLoop {
|
||||||
Write-Host "Preparing for Windows Update";
|
|
||||||
$null = Import-Module PSWindowsUpdate;
|
$null = Import-Module PSWindowsUpdate;
|
||||||
|
$hasUpdates = $false;
|
||||||
|
Write-Host "Searching for updates…";
|
||||||
|
|
||||||
while (((Get-WindowsUpdate -IgnoreReboot).Count -gt 0)) {
|
while (((Get-WindowsUpdate -IgnoreReboot).Count -gt 0)) {
|
||||||
Write-Host "There are updates available.";
|
Write-Host "There are updates available.";
|
||||||
Write-Host "Installing updates";
|
Write-Host "Installing updates";
|
||||||
|
$hasUpdates = $true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$null = Install-WindowsUpdate -AcceptAll -IgnoreReboot -ErrorAction "SilentlyContinue";
|
$null = Install-WindowsUpdate -AcceptAll -IgnoreReboot -ErrorAction "SilentlyContinue";
|
||||||
|
@ -28,6 +30,10 @@ function Update-WindowsInstallation {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (-not $hasUpdates) {
|
||||||
|
Write-Host "There are no updates available.";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Start-UpdateLoop;
|
Start-UpdateLoop;
|
||||||
|
|
Loading…
Reference in a new issue