Powershell

Shortening Text

Let's assume you want to chop off some text at the end of a string. This is the traditional approach using string operations: $text = "Some...

read more

Avoid Using Redirection

While you can still use the old redirection operator to write command output to a file, you should rather use PowerShell cmdlets instead. Here is...

read more

Encode PowerShell Commands

When you need to run code as a PowerShell command in a separate powershell.exe, it is not always safe to submit the code. Depending on from where...

read more

Define Multiline Text

When you need to define multiline text, in PowerShell you typically use here-strings like this: $text = @" I am safe here I can even use...

read more

Current Script Path

In PowerShell 1.0 and 2.0, you needed a lot of weird code to find out the current script location: # make sure the script is saved and NOT...

read more

Change ISE Zoom Level

The PowerShell ISE sports a zoom slider at its lower right edge, and you can control this slider with PowerShell code. So you could set defaults for...

read more

Unzipping ZIP Files

In PowerShell 5.0, there is a new cmdlet that can unzip ZIP files: #requires -Version 5 $Source = 'C:\somezipfile.zip' $Destination =...

read more

Testing a Network Port

To see whether you can access a remote computer via a given network port, here is a test function called Test-Port; it takes a remote computer name...

read more

Finding Logged On Users

In a previous tip we explained how you find the physically logged on user. In this tip you will see how you can list the current logon sessions,...

read more

Get Command History as File

The built-in PowerShell ISE editor that ships with PowerShell 3.0 or better can be customized, and you can add your own menu items. When you run the...

read more

Using PowerShell Help

To access the full PowerShell help, you first need to download help information from the Internet. Simply launch a PowerShell console with full...

read more
1 62 63 64 65 66 130