Powershell

Logging Input Commands

If you'd like to maintain a log file with all the commands you entered interactively - in the PowerShell console as well as in the ISE editor -...

read more

Protecting Functions

To prevent a function to be redefined or overwritten, you can write-protect it: function Test-Function { 'Hello World!' } Set-Item -Path...

read more

Finding Built-In Cmdlets

In times where cmdlets can originate from all kinds of modules, it sometimes becomes important to find out which cmdlets are truly built into...

read more

Detecting STA-Mode

Here is a simple line that tells you whether PowerShell runs in MTA- or STA-mode: [Runspace]::DefaultRunspace.ApartmentState -eq 'STA' This...

read more

Finding IP Address

There are various ways to determine the IP address that is assigned to your machine. Here is a rather unusual approach that uses text operators to...

read more

Change Order of CSV Columns

If you have a CSV file and would like to change the order of columns, simply import it into PowerShell, use Select-Object to change the order, and...

read more

Find Open Files

To find open files on a remote system, use openfiles.exe and convert the results to rich objects. Here is a sample (replace "storage1"...

read more
1 85 86 87 88 89 130