PowerShell

If you have mastered PowerShell, you don’t need these 3rd Party Tools anymore

As the headline says, I am going to show you which tools are no longer needed when you are familiar with PowerShell. No long speeches today, just examples. I’m pretty sure some of you will find something new here. Let’s start …

WinZip / 7zip

With PowerShell 5.0 two new commands are introduced: Compress-Archive and Expand- Archive. The commands compress and decompress data.

Compress-Archive -Path C:\Temp\* -DestinationPath C:\Temp\Compressed.zip

Unbenannt.PNG


Expand-Archive -Path C:\Temp\Compressed.zip -DestinationPath C:\Temp\

Unbenannt.PNG

Article: Use PowerShell to create compressed ZIP files

Makecert

To create a certificate for digital signing, encryption and more enter


New-SelfSignedCertificate -DnsName pewa2303 -CertStoreLocation "Cert:\CurrentUser\My" -KeyUsage KeyEncipherment,DataEncipherment, KeyAgreement -Type DocumentEncryptionCert

Unbenannt.PNG

Unbenannt.PNG

Microsoft Docs: https://docs.microsoft.com/en-us/powershell/module/pkiclient/new-selfsignedcertificate?view=win10-ps

Various Encryption Tools vs. Protect-CMSMessage

The Protect-CmsMessage cmdlet encrypts content. Make sure, you’re running PowerShell 5.0 or above and you have created a certificate as shown above.


"This is a secret message" | Protect-CmsMessage -To cn=pewa2303 -OutFile C:\Temp\secret.txt

Unbenannt.PNG

To decrypt data run


Unprotect-CmsMessage -Path C:\Temp\secret.txt

Unbenannt.PNG

Article: PowerShell: Encrypt and Decrypt Data by using Certificates (Public Key / Private Key)

Putty

Putty is a great tool. If you want to connect to remote hosts you can also use the PowerShell Module Posh-SSH.

First install it via online repository.


Find-Module Posh-SSH | Install-Module

Then connect to your Linux, Cisco or whatever host.


New-SSHSession -ComputerName Server01

42.jpg

Then run your commands.


Invoke-SSHCommand -SessionId 0 -Command cut -d: -f1 /etc/passwd

1.JPG

Article: PowerShell: Use SSH to connect to remote hosts (Posh-SSH)

Nmap

The following can’t compete with nmap, but it is included with Windows and ready to go out of the box.


Test-NetConnection www.sid-500.com -Port 443

4.PNG

Article: PowerShell: Check open/closed ports with Test-NetConnection

HashCheck or what they are called

To view the hash of a file run


Get-FileHash -Path C:\Patrick\Data.txt | Format-List

Unbenannt.JPG

Article: PowerShell: Checking integrity with Get-FileHash

Everest

If you are familiar with WMI, you can check everything about your system.


Get-WmiObject win32_physicalmemory | Format-Table Manufacturer,Banklabel,Configuredclockspeed,Devicelocator,Capacity,Serialnumber -autosize

Unbenannt.PNG

Article: PowerShell: Getting RAM Info by manufacturer, speed, serial number and capacity

Various ping tools

If you want to do a ping to multiple hosts use Test-Connection.


Test-Connection www.sid-500.com,192.168.0.105

1.PNG

Quiet Mode


Test-Connection sid-500.com,192.168.0.105 -Quiet

2.PNG

Article: The modern version of ping: Test-Connection

Conclusion

There are two reasons why Windows users install so many 3rd party tools: Either the tools are better than the supplied tools or there is a lack of knowledge.

In any case, before deciding to install a tool, you should take a look around to see if it is possible with Windows onboard tools.

I hope the contribution was helpful and informative.

3 replies »

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.