Powershell

Scanning Ports

Here is a straightforward way to test ports on a local or remote system. You can even specify a timeout (in milliseconds): function Get-PortInfo {...

Resetting Console Colors

It can be easy to mess up console colors in the PowerShell console. A single call with accidental values, or a script that messed with the colors,...

Solving SSL Connection Problems

Sometimes when you try to access web services (or download internet content in general), PowerShell may bail out and complain about not being able...

Listing Network Drives

There are many ways to create a list of network drives. One involves a COM interface that was used by VBScript as well, and we’ll pick it to...

Sending Emails via Outlook

You can always use Send-MailMessage to send a mail via any SMTP server. If you’d like to use your Outlook client, though, i.e. to keep access...

Formatting Date and Time (with Culture)

In the previous tip we illustrated how Get-Date can take a format string and convert DateTime values to strings. The string conversion always uses...

Formatting Date and Time

Formatting date and time to your needs is easy with the -Format parameter provided by Get-Date. You can use it either with the current date, or...

Printing Test Pages on Printers

Windows 10 and Windows Server 2016 come with extensive printer support thanks to the PrintManagement module. If you’d like to print official...

Accessing Event Logs Directly

With Get-EventLog, you can easily dump the content for any given event log, however if you’d like to directly access a given event log, you...

Using a Stop Watch

In PowerShell, to measure time, you can simply subtract datetime values from another: $Start = Get-Date $null = Read-Host -Prompt "Press ENTER...

Finding Open Firewall Ports

Here is a piece of PowerShell code that connects to the local firewall and dumps the open firewall ports: $firewall = New-object -ComObject...

Executing Code with a Timeout (Part 2)

In the previous tip we implemented a timeout using PowerShell background jobs so you could set a maximum time some code was allowed to run before it...

1 20 21 22 23 24 104