Home / Windows 10

Why use The PowerShell?

Admittedly, if you are an average Windows user who does not use the Command Prompt (except for the additional IPconfig or two), then you might not gain much from dabbling in the PowerShell. While powerful, it is still more difficult than the (already daunting) Linux terminal.

However, if you are a power user who wants to have more control over your system than the default Windows settings allow you, then you will most likely find the PowerShell useful. Think of doing normally complex tasks with a few lines of cmdlets, such as batch-renaming multiple files in a certain folder or performing a search-and-replace operation -- all without using third-party apps.

If you are a system administrator, then you have the most to gain as the PowerShell lets you manage your systems more effectively through automated administration tasks and other scripts.

If you do find yourself adventurous enough to use the PowerShell, here are a few of the more common DOS (Command Prompt) commands and their equivalent cmdlets.

Changing Directories:

DOS: cd

PowerShell: Set-Location

Listing all Files in a Single Directory:

DOS: dir

PowerShell: Get-ChildItem

Renaming Files:

DOS: rename

PowerShell: Rename-Item

You can also see if any of the DOS commands you would like to use have cmdlet aliases by using the "Get-Alias" cmdlet. For example, typing "Get-Alias cd" will tell you that cd is now the Set-Location cmdlet.

Windows 10 PowerShell Improvements

Upon the release of Windows 10, the powerful PowerShell also received an upgrade beyond the ones we discussed with the Command Prompt. Here are some of them:

PackageManagement

The package management is the way to manage all of the Windows software you downloaded and installed. Instead of hopping through different websites in order to find different software, a user will have the option to browse all of them at once with the PackageManager. This system was formerly known as OneGer -- a feature that became available in Windows 8.1 with the installation of the Windows Management Framework 5.0. With the advent of Windows 10, you can get access to it by default.

The biggest draw with this PowerShell feature is the fact that you can now go full Linux-type install on your system, if you are a power user. Simply type in the corresponding cmdlets, and you can install multiple programs at once without even visiting their websites. In order to make the package available for you, you need to simply subscribe to the needed repositories.

Secure Shell (SSH). The secure shell has been a staple protocol in the establishment of encrypted connection between remote systems. Unless SSH is involved, it is quite easy for outsiders to intercept the transmitted data.

Until some of the latest updates, using SSH on Windows will require the use of a third-party solution such as PuTTY. However, the new Win10 PowerShell will be incorporating SSH support by default.

Power Features: If you are a PowerShell junkie, the language itself is being enhanced with some added features including classes, enums, built-in commands, syntax coloring, and additional features for existing commands.

Interested in how PowerShell can make your life easier? Check out the next section.

PowerShell Tips and Tricks

Uninstalling Pre-Installed Applications:

Like any package manager worth its salt, PackageManagement also has the ability to remove any applications you currently have. This is especially useful for those who wish to remove preinstalled apps that cannot be uninstalled through the conventional methods -- for those who are complaining of "bloat" or those who simply wish to start with a fresh Win10 install sans the apps.

  • Open the elevated PowerShell. This means that you need to run the program as an administrator; that way, you'll have better access and privileges. Simply press the Win key and search "powershell" in the resulting search box. Right click on the result, and then select "Run as Administrator". There will be a UAC (User Access Control) prompt, where you will click "Yes".
  • Use Get-AppxPackage: This is a simple cmdlet that will return a list of all applications installed within your current profile (.appx files). If you wish to obtain a list of all installed applications within all user profiles in your device, run the cmdlet with the -AllUsers parameter as suffix.
  • Check the PackageFullName field: This can be seen as you browse through the apps. Find any program that you want removed and check its Package Full Name. Note that these names aren't exactly the easiest to read, so you might need to take them down. Do it verbatim -- you will not want to mistakenly remove an app you want to keep.
  • Use the command Remove-AppxPackage <PackageFullName> in order to uninstall. Afterwards, you're done! It's as simple as that.
  • If you fancy something more geeky, you can combine the two commands into a single "pipe" (|) command. This will take the output from the left-hand command (Get-AppxPackage) as an input for the right-hand command (Remove-AppxPackage).

Here are a few preinstalled applications that you might want to remove. Take note that while testing does not yield any harm derived from the removal of these programs, the consequences of running the removal script will be on the user. We also recommend actually checking these software programs out before dismissing them as bloatware -- you should actually find some of them useful.

  • WindowsCamera
  • ZuneMusic
  • WindowsMaps
  • MicrosoftSolitaireCollection
  • BingFinance
  • ZuneVideo
  • BingNews
  • WindowsPhone
  • WindowsPhotos
  • BingSports
  • XboxApp
  • BingWeather
  • WindowsSoundRecorder
  • 3DBuilder
  • SkypeApp
  • MicrosoftOfficeHub

Fetching a list of installed drivers

Despite the smooth rollover into Win10 from previous operating systems, there is still a lingering concern over driver compatibility especially with older devices. Of course, nobody would want to upgrade to Win10 and find that they don't have the right drivers for the mouse -- hence, the compatibility tests that we discussed in an earlier tutorial.

But in case the device is still compatible, you might still want to upgrade the drivers to make it work as it should. In this process, it is important to see how your current driver measures up.

Open an elevated PowerShell.

Use the Get-WindowsDriver command. This will output a list of all information about the current driver packages you have installed. Only third-party ones are included by default.

If you want to see only the drivers for the system currently running, then you will have to append the "-Online" parameter. If you want everything plus the kitchen sink, append the "-All" parameter instead.

SCANNING FOR MALWARE THREAT

Since the Microsoft Security Essentials have already been discontinued, Windows Defender has taken its place. While it is not the best tool for the job of finding and eliminating malware threats, it is still quite capable.

However, there are some times when Windows Defender cannot be counted on to run, such as when it has been rendered unusable by another piece of software. In case you do not have any backup against threats, you would need to find a way to scan your system. Here, the PowerShell can be the perfect answer.

As earlier, open an elevated PowerShell and accept the UAC prompt.

Use the Start-MpScan command. This will scan using the system's default parameters. If you wish, you may signify the drive or directory that will be scanned through an additional parameter such as -ScanPath "C:". You may also start a scan using the cmdlet -ScanType [QuickScan/FullScan/CustomScan].

Like any other security software, the threat scans in Windows Defender can only be as good as the threat signatures it can guard against. Update your threat definitions by running Update-MpSignature.

Installing Apps Through PackageManagement

Of course, if the PowerShell can remove applications, it can also add them through PackageManagement! Here's to saving the best for last:

First, check out a list of all the cmdlets available under PackageManagement by running "Get-Command -Module PackageManagement". If you were a Windows 8 user, substituting OneGet for PackageManagement will no longer work.

The resulting screen should tell you what commands you need to run for which actions. "Get-PackageProvider" and "Get-PackageSource", for example, will tell you which providers and sources are available. Package sources are those hosts that contain all the different applications you can choose to install. Some programs may only be available in certain repositories, so you might have to install multiple sources.

If you wish to install a package source such as Chocolatey (a useful community-managed one-stop shop for programs), you can use "Register-PackageSource". Note that the last one requires a URL for the source. You can later un-register this using the "Unregister-PackageSource" cmdlet.

Use the following cmdlets to find, install and uninstall packages:

  • "Find-Package <search keyword>"
  • "Install-Package <name>"
  • "Uninstall-Package <name>"

A quick but important note with the use of PackageManager, though, is that Microsoft is not adopting the package management feature as a standard process in Windows 10. As of yet, Microsoft is not hosting its own software repositories -- not even for the Windows Store and all the applications therein. Support and integration of third-party sources such as the aforementioned Chocolatey are also not yet standard -- as it looks like right now, PackageManagement is still largely geared towards usage by system administrators.

This system was meant to be a standard and simple way of installing software from centralized sources. While the entire layout of PackageManager is still technically in its infancy, it should be reasonable to expect in the future that we will be seeing additional package source integration and more options for this concept.

The Windows "SUDO" -- Elevation

There are some users who still cannot get by with just the regular Windows permissions -- either they want to go in deep or they want to do something that Windows passively prevents them from doing. This prompts users to look for the Windows equivalent of the famous Linux and Unix-like "sudo" -- root access, or to put simply, a way to gain each. In Windows, this is possible using Command Prompt and PowerShell "elevation".

By default, when an instance of either the Command Prompt or PowerShell is activated, the user still does not gain absolute administrative rights -- some commands will not work. This was meant to protect unsuspecting users from running commands that can harm their systems. In Windows Vista, the elevation scheme was added to give users a chance to really control their system -- provided they take responsibility for all changes that occur afterwards.

When Should I use Elevation?

Because of the inherent dangers (such as wiping out your system or parts of it in one go), it is important to make sure that you know exactly what you are doing before running elevation. If you are following a tutorial such as the ones that we discussed above, you will know you need elevation when you run into the error "The requested operation requires elevation". Still, make sure that you are following the tutorial step-by-step and make sure you know what will happen when you complete it.

How do I Elevate the Command Prompt?

  1. Click on the Start button (or press the Win key). In the resulting search box, type "cmd".
  2. After searching, you will see a result that says "cmd.exe". Right-click on it, and choose "Run as Administrator" from the context menu. You will have the UAC prompt as discussed in a previous section. Click on "yes" to start the elevated command prompt.

Alternatively:

  1. Click on Start (or press the Win key), then search "cmd". However, instead of simply hitting "Enter", hit the Ctrl+Shift+Enter combination instead.
  2. This will prompt the UAC window to appear. Click on "Yes" to initiate the elevated command prompt.

How DO I Elevate The PowerShell?

To launch an elevated instance of the PowerShell, simply follow the same instructions as that in the command prompt. However, search "powershell" instead of "cmd".

[Previous....Command Prompt and PowerShell]