Windows quick bites
Three useful Windows commands:
1) Getting MD5/SHA hash of a file
I've always envied Linux users for having built-in md5sum command but now there is a command in Windows PowerShell that does the same function!
2) Getting license key of upgraded Windows installation
With Windows moving towards digital license, here's how to find out what's the license key on your working computer in case you ever decide to reinstall.
3) Download files over http/https using PowerShell
Have a URL that points to a file that you'll like to download but your browser stupidly insists on rendering it in gibberish instead of downloading as a file? Now we have wget like function in the form of PowerShell's Invoke-WebRequest.
Note that if you are using URL beginning with https and getting the error "Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel", it is likely due to the wrong TLS version used. (PowerShell defaults to TLS 1.0 but the site is most likely using TLS 1.2.)
Just run the following command to switch to TLS 1.2 before running Invoke-WebRequest again:
1) Getting MD5/SHA hash of a file
I've always envied Linux users for having built-in md5sum command but now there is a command in Windows PowerShell that does the same function!
> Get-FileHash -Path C:\Users\YourName\Downloads\some.iso -Algorithm MD5 Algorithm Hash Path --------- ---- ---- MD5 ABCDEFGHIJKLMNOPQRSTUVWXYZ123456 C:\Users\YourName\Downloa...
2) Getting license key of upgraded Windows installation
With Windows moving towards digital license, here's how to find out what's the license key on your working computer in case you ever decide to reinstall.
> wmic path softwarelicensingservice get OA3xOriginalProductKey OA3xOriginalProductKey ABCDE-FGHIJ-KLMNO-P1234-56789
3) Download files over http/https using PowerShell
Have a URL that points to a file that you'll like to download but your browser stupidly insists on rendering it in gibberish instead of downloading as a file? Now we have wget like function in the form of PowerShell's Invoke-WebRequest.
> Invoke-WebRequest -Uri <url-to-file> -OutFile <path-to-save-file-as>
Note that if you are using URL beginning with https and getting the error "Invoke-WebRequest : The request was aborted: Could not create SSL/TLS secure channel", it is likely due to the wrong TLS version used. (PowerShell defaults to TLS 1.0 but the site is most likely using TLS 1.2.)
Just run the following command to switch to TLS 1.2 before running Invoke-WebRequest again:
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Comments
Post a Comment