Powershell

Dynamic Methods in PowerShell 4

Beginning with PowerShell 4.0, method names may come from variables. Here's a simple example: $method = 'ToUpper'...

Dynamic Parameters in PowerShell 4.0

In PowerShell, you can use variables in place of properties. This sample script defines the four property names that return profile paths, then...

Finding Services in PowerShell

Get-Service lists all services on a computer, but the information returned is very sparse. You cannot easily see what a service does, whether it is...

Hiding Parameters from IntelliSense

Beginning with PowerShell 4.0, a script author can decide to hide function parameters from IntelliSense. This way, less frequently used parameters...

Searching in Different Domains

When you use the ADSISearcher type accelerator to find Active Directory accounts, it defaults to the current domain you are logged on to. If you...

Getting Domain from DN

A "DN" (Distinguished Name) is the path to an Active Directory object and could look similar to this:...

Converting Binary SID to String SID

Active Directory accounts contain the SID in binary form. To convert the byte array into a string representation, use a .NET function like this: #...

Finding Current Script Folder

Beginning in PowerShell 3.0, there is a very easy way of determining the folder a script is located in: $PSScriptRoot. This variable always holds...

Finding AD User Accounts

There are modules and cmdlets to deal with Active Directory tasks, but sometimes it is easier and faster to simply use some .NET code instead. If...

Resetting PowerShell Host in ISE

Imagine you have worked long hours on a script in the ISE editor. While you worked on it, you probably have defined variables, created functions,...

Finding Cmdlets

Get-Command can be used to find cmdlets, but in PowerShell 3.0 it will often return many more cmdlets than expected. Due to module auto-loading,...

What Is Going On Here?

Frequently, you will have PowerShell retrieve data, and then you pick parts of the information and use it in reports. Like here: $serial =...

Password Obfuscator Script

Ever had the need to store a password in a script? Ever needed to automate a credential dialog? First: storing passwords and other confidential...

Converting Excel CSV to UTF8

When you export Microsoft Excel spreadsheets to CSV files, Excel by default saves CSV files in ANSI encoding. That's bad because special...

Finding All PowerShell Profile Scripts

Sometimes it can get confusing which startup scripts run when PowerShell starts. There can be plenty, and they may be different, depending on...

Creating Objects with CSV

There are many ways to create custom objects. Here's a creative solution that can be useful in many scenarios: create a text-based...

Finding Scripts by Keyword

With an increasing number of PowerShell scripts on your hard drive, it can become hard to find the script you are looking for. Here's a helper...

Setting Monitor Brightness

If your display driver supports WMI, then you can change the display brightness using PowerShell - event on remote machines! Here's the...

Check Monitor Brightness

If you want to check your current display brightness (preferably on notebooks, of course), here's a quick function: function...

Creating Symbolic Links

Symbolic links work very similar to "regular" link files (*.lnk): they can point to virtually any file or folder and even UNC paths....

1 64 65 66 67 68 104