ps1

Checking for AC Power

Ask WMI to find out whether your notebook is connected to AC: #requires -Version 1 $battery = Get-WmiObject -Class Win32_Battery | Select-Object...

read more

Creating Enumerations

PowerShell 5.0 added the capabilities to define enumerations but in older PowerShell versions, you can create enumerations too, simply by compiling...

read more

Crazy Prompt Function

The built-in "prompt" function is invoked whenever PowerShell completed interactive input, and you can use it to change the way your...

read more

Using Paths in Prompts

The default PowerShell prompt displays the current location. When you are deep inside nested folders, this steals room for your actual input, and...

read more

Try CTRL+SPACE!

In the PowerShell ISE, there are two key shortcuts that can help you. Pressing TAB works just like in the console, and each time you press TAB, you...

read more

Finding Loaded Assemblies

To dump all .NET assemblies that are loaded in a PowerShell session, try this: System.AppDomain]::CurrentDomain.GetAssemblies() | Where-Object...

read more

Increase History Cache

Command history can be a great help when you work for a while in a PowerShell session. Each session stores the commands you issued, and you can...

read more

Getting Last Bootup Time

In PowerShell 3.0 and better, it's trivial to get back real DateTime information from WMI using Get-CimInstance. This would tell you when your...

read more

Copying Arrays (Part 2)

In a previous tip we explained how you can safely "clone" an array using Clone() method. This will copy the content of an array to a new...

read more

Copying Arrays (Part 1)

When you copy variable content, you may just copy the "reference" (memory address), not the content. Take a look at this example: $a =...

read more

Using Encoded Scripts

In VBScript there were encoded scripts. Encoding is by no means a safe way of hiding script content, but it makes it a little harder for users to...

read more
1 56 57 58 59 60 128