Author: Peter Barnett Date: Mar 08, 2019
EMCO Remote Installer is an easy-to-use network application designed for centralized software management and audit across a LAN. It offers a simple and effective approach to remote software distribution and can be used instead of SCCM and other complicated deployment tools. Select Install to install an extension on your remote host. You can also install all locally installed extensions on the SSH host by going to the Extensions view and selecting Install Local Extensions in SSH: Hostname using the cloud button at the right of the Local - Installed title bar.
- Install the client. Choose the client that matches the version of Windows. The new Remote Desktop client (MSRDC) supports Windows 10, Windows 10 IoT Enterprise, and Windows 7 client devices.
- The easy way to remotely connect with your home or work computer, or share your screen with others. Securely access your computer whenever you're away, using your phone, tablet, or another computer. Share your screen to collaborate in real-time, or connect with another computer to give or receive remote support.
- Remotely is free and open-source, and there are multiple ways to start using it. Download the portable client to try out instant screen sharing Create an account on the public server that we host for you Install a server package to host a server yourself.
Timely updating the software installed in the company and installing the required patches is one of the important tasks, the implementation of which allows you to avoid various software malfunctions, as well as to ensure an adequate level of security. How can you centrally and remotely manage software updates and patches in a company? To do this, there are various solutions called patch management tool. If you have ever had to install Windows updates, as in patching servers, you know you have to log into servers and allow updates to install, suppressing reboots along the way. I will focus on windows update in powershell today (Invoke-WUInstall), used to install Windows updates remotely. | Fully functional for 50 endpoints, never expires. More details > |
1. Installing PSWindowsUpdate PowerShell Module
Since PSWindowsUpdate is not installed on Windows by default, we have to first install the module.
PS C:WINDOWSsystem32> Install-Module PSWindowsUpdate -MaximumVersion 1.5.2.6
If we run Get-Command we can see all of the commands in the PSWindowsUpdate module:
PS C:WINDOWSsystem32> Get-Command -Module PSWindowsUpdate
CommandType Name Version Source
- ----------- ---- ------- ------
Alias Get-WindowsUpdate 1.5.2.6 pswindowsupdate
Alias Hide-WindowsUpdate 1.5.2.6 pswindowsupdate
Alias Install-WindowsUpdate 1.5.2.6 pswindowsupdate
Alias Uninstall-WindowsUpdate 1.5.2.6 pswindowsupdate
Function Add-WUOfflineSync 1.5.2.6 pswindowsupdate
Function Add-WUServiceManager 1.5.2.6 pswindowsupdate
Function Get-WUHistory 1.5.2.6 pswindowsupdate
Function Get-WUInstall 1.5.2.6 pswindowsupdate
Function Get-WUInstallerStatus 1.5.2.6 pswindowsupdate
Function Get-WUList 1.5.2.6 pswindowsupdate
Function Get-WURebootStatus 1.5.2.6 pswindowsupdate
Function Get-WUServiceManager 1.5.2.6 pswindowsupdate
Function Get-WUUninstall 1.5.2.6 pswindowsupdate
Function Hide-WUUpdate 1.5.2.6 pswindowsupdate
Function Invoke-WUInstall 1.5.2.6 pswindowsupdate
Function Remove-WUOfflineSync 1.5.2.6 pswindowsupdate
Function Remove-WUServiceManager 1.5.2.6 pswindowsupdate
2. How Invoke-WUInstall Works
One different aspect of using Invoke-WUInstall is that it does not use traditional remoting methods to perform Windows update in PowerShell. When you look at the source code, it actually creates and immediately runs a scheduled task on the remote machine under the SYSTEM account.
Write-Verbose 'Create schedule service object'
$Scheduler = New-Object -ComObject Schedule.Service
$Task = $Scheduler.NewTask(0)
$RegistrationInfo = $Task.RegistrationInfo
$RegistrationInfo.Description = $TaskName
$RegistrationInfo.Author = $User.Name
$Settings = $Task.Settings
$Settings.Enabled = $True
$Settings.StartWhenAvailable = $True
$Settings.Hidden = $False
$Action = $Task.Actions.Create(0)
$Action.Path = 'powershell'
$Action.Arguments = '-Command $Script'
$Task.Principal.RunLevel = 1
typical use of Invoke-WUInstall would be:
Invoke-WUInstall -ComputerName Test-1 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:PSWindowsUpdate.log }-Confirm:$false –Verbose
In this command we see Get-WUInstall
, which is the command PSWindowsUpdate uses to install updates, usually from your Windows Server Update Services (WSUS) server. Get-WUInstall
simply uses a COM object for Windows updates to perform the tasks needed. Notice also the use of the -AcceptAll
parameter, which means it will automatically accept any updates to install.
One nice feature of Invoke-WUInstall is that it actually installs the PSWindowsUpdate module on the remote machine (if it isn't there already). This is great when you are using the module on a new machine, or when you decide to use it for the first time.
- C: > $cim = New-CimSession -ComputerName Test-1
- C: > $cim
- Id : 2
- Name : CimSession2
- InstanceId : afa8c63d-fb1f-46f9-8082-c66238750a92
- ComputerName : Test-1
- Protocol : WSMAN
- C:ScriptsPowerShell> (Get-ScheduledTask -TaskPath ' -CimSession $cim -TaskName PSWindowsUpdate).actions
- Id :
- Arguments : -Command ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-File C:PSWindowsUpdate.log
- Execute : powershell
- WorkingDirectory :
- PSComputerName : Test-1
As you can see, the scheduled task is going to run ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll -AutoReboot | Out-File C:PSWindowsUpdate.log.
Using Out-File will ensure the logs of downloading and installing updates are visible so we can check against them later..
3. Install Updates on Multiple Machines
The true power of Invoke-WUInstall is when you have to install updates on many machines at once. This is very easy to do, all you need is to add machines to the ‑ComputerName
parameter, which then processes them in a loop (not in parallel unfortunately).
- C: > Invoke-WUInstall -ComputerName Test-1,Test-2,Test-3,Test-4 -Script {ipmo PSWindowsUpdate; Get-WUInstall -AcceptAll | Out-File C:
- PSWindowsUpdate.log } -Confirm:$false -Verbose
- VERBOSE: Populating RepositorySourceLocation property for module PSWindowsUpdate.
- VERBOSE: Loading module from path 'C:Program FilesWindowsPowerShellModulesPSWindowsUpdate1.5.2.6PSWindowsUpdate.psm1'.
- VERBOSE: Create schedule service object
- VERBOSE: Performing the operation 'Invoke WUInstall' on target 'Test-1'.
4. Windows Update in Powershell: Finding Errors
One great reason to output to a log on the remote machine is to confirm that no errors installing updates on these remote machines occurred. With some simple PowerShell, we can query these log files and search for failures.
Here is what a typical log looks like after using Get-WUInstall -AcceptAll | Out-File C: PSWindowsUpdate.log
:
It includes the status of the update, its KB number, size, and title—all great information to have handy when installing updates.
Using Invoke-Command, Get-Item, and Select-String, we can use a quick technique to easily work through any computers used with Invoke-WUInstall and check for updates that failed to install:
- C:> Invoke-Command -ComputerName Test-1,Test-2,Test-3 -ScriptBlock {
- >> Get-Item C:PSWindowsUpdate.log | Select-String -Pattern 'failed' -SimpleMatch |
- >> Select-Object -Property line } | Select-Object -Property Line,PSComputerName
- Line PSComputerName
- ---- --------------
- 4 Failed KB4103712 30 MB 2018-05 Security Only Quality Update for Windo... Test-1
Consider using Action1 to install Windows updates remotely if:
- - You need to perform an action on multiple computers simultaneously.
- - You have remote employees with computers not connected to your corporate network.
Action1 is a cloud-based platform for patch management, software deployment, remote desktop, software/hardware inventory, endpoint management and endpoint configuration reporting.
Start your free trial or use free forever to manage up to 50 endpoints. More details >
Relevant How To Articles and Action1 Features:
Install R Packages from remote or local repositories, including GitHub, GitLab, Bitbucket, and Bioconductor
Download and install R packages stored in GitHub, GitLab, Bitbucket, Bioconductor, or plain subversion or git repositories. This package is a lightweight replacement of the install_*
functions in devtools
. Indeed most of the code was copied over from devtools
.
Features
- Installers:
- Install packages with their dependencies.
- Install from GitHub, GitLab, Bitbucket.
- Install from git and subversion repositories.
- Install from local files or URLs.
- Install the dependencies of a local package tree.
- Install specific package versions from CRAN.
- Supports Bioconductor packages.
- Supports the
Remotes
field inDESCRIPTION
. See more in the dependencies vignette. - Supports the
Additional_repositories
field inDESCRIPTION
. - Can install itself from GitHub (see below).
- Does not depend on other R packages.
- Does not contain compiled code, so no compiler is needed.
- Does not need any external software (for most of the functionality at least).
Installation
Install the released version of remotes from CRAN:
Usage
Note that most of the examples here use GitHub. See below for other supported repository types.
To install the latest version of a package in the default branch from GitHub, you can use the user/repo
form. Note that user
can also be an organization:
If the R package is inside a subdirectory of the root directory, then give this subdirectory as well:
To install a certain branch or commit or tag, append it to the repo name, after an @
:
To install the latest release, append @*release
to the repo name:
To install a pull request, append #
and the id (an integer number) of the pull request to the repo name:
Dependencies
Dependencies are automatically installed from CRAN. By default, outdated dependencies are automatically upgraded. In interactive sessions you can select a subset of the dependencies to upgrade.
Dependencies on GitHub
It is also possible to install dependencies from GitHub or other supported repositories. For this you need to add a Remotes
field to the DESCRIPTION
file. Its format is:
where repo_spec
is any repository specification the corresponding install_()
function can handle. If remote::
is missing, github::
is assumed. Other possible values: gitlab::
,bitbucket::
, git::
, local::
, svn::
, url::
, version::
, cran::
, bioc::
.
See more about the Remotes
field in this vignette.
Additional repositories
remotes supports the Additional_repositories
field in DESCRIPTION
. This is a way to specify dependencies from non-CRAN package repositories. See the Writing R extensions manual for details.
Bioconductor packages
Bioconductor packages are automatically detected and their dependencies are installed from Bioconductor.
Currently supported remote types
- GitHub repositories via
install_github
. - Bitbucket repositories via
install_bitbucket
. - Generic git repositories via
install_git
. They need either a system git installation, or the git2r R package. - Local directories or package archive files via
install_local
. - Remote package archive files via
install_url
. - Packages in subversion repositories via
install_svn
. They need a system subversion installation. - Specific package versions from CRAN or other CRAN-like repositories via
install_version
. This includes outdated and archived packages as well. - All dependencies of a package in a local directory via
install_deps
.
Download methods
- For R older than 3.2, the curl package is required as remotes falls back to
curl::curl_download
in that case - For R newer than 3.3, default
download.file()
method is used. (method = 'auto'
) - For in between versions,
method = 'wininet'
is used on windows OSmethod = 'libcurl'
is used on other OS, if available.
See help('download.file')
for informations on these methods and for setting proxies if needed.
Standalone mode
remotes will use the curl, git2r and pkgbuild packages if they are installed to provide faster implementations for some aspects of the install process. However if you are using remotes to install or update these packages (or their reverse dependencies) using them during installation may fail (particularly on Windows).
If you set the environment variable R_REMOTES_STANDALONE='true'
(e.g. in R Sys.setenv(R_REMOTES_STANDALONE='true')
) you can force remotes to operate in standalone mode and use only its internal R implementations. This will allow successful installation of these packages.
Options
remotes uses the following standard R options, see ?options
for their details:
Remote Install Android Spy
download.file.method
for the default download method. See?download.file
.pkgType
for the package type (source or binary, see manual) to install, download or look up dependencies for.repos
for the locations of the user’s standard CRAN(-like) repositories.
Remote Installing
It also uses some remotes specific options:
Remote Install Spy App
BioC_git
for the URL of the default Bioconductor git mirror.BioC_mirror
for the URL of the Bioconductor mirror.unzip
for the path of the externalunzip
program.
Environment variables
The
BITBUCKET_USER
andBITBUCKET_PASSWORD
environment variables are used for the default Bitbucket user name and password, ininstall_bitbucket()
The
GITHUB_PAT
environment variable is used as the default GitHub personal access token for all GitHub API queries.The
R_BIOC_MIRROR
environment variable can be used to specify an alternative Bioconductor mirror. (TheBioC_mirror
option takes precedence over this.)The
R_BIOC_VERSION
environment variable can be used to force a Bioconductor version.The
R_REMOTES_UPGRADE
environment variable can be used to set a default preferred value for theupgrade =
argument accepted by the variousinstall_*()
functions. For example, you can setR_REMOTES_UPGRADE='always'
to upgrade dependent packages without asking the user.Setting
R_REMOTES_STANDALONE='true'
forces remotes to work in standalone mode and avoid loading its optional dependencies (curl, git2 and pkgbuild currently. See “Standalone mode” above.Setting
R_REMOTES_NO_ERRORS_FROM_WARNINGS='false'
will cause warning messages during calls toinstall.packages()
to become errors. Often warning messages are caused by dependencies failing to install.