Powershell is a great tool, however, it can get a little trickier than you might expect. Today we needed to extract all updates from a computer.Suddenly, a little Powershell should have done the trick with a simple command. But no.
Initially, the “Get-Hotfix” command allows you to retrieve the entire list of updates installed on a computer. Coupled with the variable “computer name” we can retrieve the list on a remote computer. Then you can even have fun selecting only certain fields and sorting everything. You should also know How to get missing updates there.
Which gives the following?
Microsoft publishes PowerShell updates directly to GitHub for different platforms, be it Windows or Linux. When I talk about PowerShell, I’m talking about the product previously called PowerShell Core, not Windows PowerShell which is built into Windows.
Updates are released regularly for PowerShell, as of this writing the PowerShell version 7.0.1 is the last stable release. If you are on PowerShell 7.0, you see a message like this in the console:
Rather than bothering to update PowerShell manually, you can do it from the command line directly, which is great for doing it in a scheduled task as well 😉👍
Let’s see how to update PowerShell from the command line.
Microsoft is providing a PowerShell installation script on its GitHub; we will call it with the right arguments to perform the update. It should be noted that this could also be used to install PowerShell on a workstation.
Note: you must have administrator rights to perform this installation / update
- Here is the command to run, where we will download the script to run it with the, UseMSI parameter to get it in MSI format.
- To automate the update, you must use the -Quiet option to perform a silent installation using the MSI package.
- Wait while downloading and installing.
PowerShell will automatically close to update.
Then we can see that the PowerShell update is installed correctly:
The previous command can be easily integrated into a scheduled task if you want to automate the update, otherwise keep it in a corner to restart it later.
For information, other parameters are available:
- Preview: install the latest Preview version available
- Daily: install the build of the Daily channel
- Destination: specify a directory in which to install PowerShell
Since we are nice, we give you the command line to do this update on Linux using wet, script-based as well, in bash this time.
The process consists of three steps: download the script, run it to perform the installation, and then delete it.
How to open Powershell on Windows 10
To get started in Powershell programming, you can follow these two links:
- PowerShell Documentation.
- A Task-Based Guide to Windows PowerShell Camlets.
- A page to get started in Powershell.
- Here are some Powershell commands that allow you to manipulate files or folders.
These are just examples here since Powershell does not just stick to these aspects of files or folders and allows many other things.