Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
RaymundoAlvarad
Engaged Sweeper

Hello

I have a lansweeper server with many networks, How install windows updates with lansweeper?

this is possible?

thank you

 

3 REPLIES 3
Nafio
Engaged Sweeper

Here is my example below. Using powershell. Make sure on the first step you make a folder LNSWP_log to store the logs.  (See step 1)

Copy and paste the code below after the broken line into a ps1 file. Name it whatever you like. I named it CheckforUpdates (brilliant right 😀)

Step 1 " mkdir C:\LNSWP_log  # I make a folder where are store all Lansweeper logs for different deploys

Step 2 Start /B powershell -ExecutionPolicy RemoteSigned  -File [From your package Share] CheckforUpdates.ps1 -Force

-------------------------------------------------------------------------------


"Start Update: $(Get-Date)" > "C:\LNSWP_Log\Windows_Update.log"

# Check and install NuGet package provider
if (-not (Get-PackageProvider -Name NuGet)) {
"Installing Package NuGet" >> "C:\LNSWP_Log\Windows_Update.log"
Install-PackageProvider -Name NuGet -MinimumVersion '2.8.5.201' -Force >> "C:\LNSWP_Log\Windows_Update.log"
} else {
"Package NuGet already Installed" >> "C:\LNSWP_Log\Windows_Update.log"
}

# Check and install PSWindowsUpdate module
if (-not (Get-Module -ListAvailable -Name PSWindowsUpdate)) {
"Installing Windows Update Module" >> "C:\LNSWP_Log\Windows_Update.log"
Install-Module -Name PSWindowsUpdate -Confirm:$false -Force >> "C:\LNSWP_Log\Windows_Update.log"
} else {
"Windows Update Module already Installed" >> "C:\LNSWP_Log\Windows_Update.log"
}

# Perform Windows Update
Get-WindowsUpdate -IgnoreUserInput -MicrosoftUpdate -ForceDownload -Install -AcceptAll `
-AutoSelectOnWebSites:$true -IgnoreReboot -Confirm:$false >> "C:\LNSWP_Log\Windows_Update.log"

Get-WUInstall -AcceptAll -IgnoreReboot -Install >> "C:\LNSWP_Log\Windows_Update.log"

" " >> "C:\LNSWP_Log\Windows_Update.log"
" " >> "C:\LNSWP_Log\Windows_Update.log"

" Update History" >> "C:\LNSWP_Log\Windows_Update.log"
"----------------" >> "C:\LNSWP_Log\Windows_Update.log"


Get-WUHistory >> "C:\LNSWP_Log\Windows_Update.log" 


# Notify user and schedule reboot
cmd.exe /c msg * "Latest Updates have been applied; Please reboot your Computer"
Invoke-Command -ScriptBlock { shutdown /r /t 3600 /d P:2:3 }
Invoke-Command -ScriptBlock { msg * "Latest Updates have been applied; Please reboot your Computer" }

"End Update: $(Get-Date)" >> "C:\LNSWP_Log\Windows_Update.log"



 

Mister_Nobody
Honored Sweeper III

You have to use native Microsoft WSUS to install updates.

FrankSc
Lansweeper Tech Support
Lansweeper Tech Support

Hello RaymundoAlvarad, 

 

With our current deployment feature we create scheduled tasks on the target computer to execute the package. So you always need a running computer to deploy something on. 
While most Windows updates require a reboot and also run before or after a restart, this will become difficult. The task scheduler is not available or able to provide success or failure feedback at that stage.

Deployment Packages

Share topics/ issues related to deployment packages. Please use/rely on content with caution as it is publicly generated.

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now