Powershell

Logging What a Script Does

All PowerShell versions You probably know that in a PowerShell console (not the ISE editor), you can turn on logging: PS> Start-Transcript This...

read more

A Fun Beeping Prompt

All PowerShell versions If your computer has a sound card, here is a code snippet that will drive your colleagues nuts: function prompt { 1..3 |...

read more

Watch Out With UNC Paths!

All PowerShell versions Many cmdlets can deal with UNC paths, but using UNC paths can produce flaky scripts. Take a look at this: PS> Test-Path...

read more

Finding AD Users

All PowerShell versions Searching the AD can be done with simple calls provided you are logged on an Active Directory domain. In a previous tip we...

read more

Case-Correct Name Lists

All PowerShell versions Let’s assume it’s your job to update a list of names. Here is an approach that will make sure that only first letter in a...

read more

Hibernate System

All PowerShell versions Here is a simple system call that will hibernate a system (provided of course that hibernation is enabled): function...

read more

Recursing a Given Depth

PowerShell 3.0 and newer When you use Get-ChildItem to list folder content, you can add the –Recurse parameter to dive into all subfolders....

read more

Aliases Can Be Dangerous

All PowerShell versions Aliases enjoy the highest priority among executable commands in PowerShell, so if you have ambiguous commands, PowerShell...

read more

Delete Aliases

All PowerShell versions While you can easily create new aliases with New-Alias or Set-Alias, there is no cmdlet to delete aliases. PS> Set-Alias...

read more

Finding AD Accounts Easily

All PowerShell versions You do not necessarily need additional cmdlets to search for user accounts or computers in your Active Directory. Provided...

read more

Creating Great Reports

All PowerShell versions You can change all properties of objects when you clone them. Cloning objects can be done to “detach” the object...

read more

Accepting Multiple Input

All PowerShell versions When you create PowerShell functions, here is a template that defines a InputObject parameter that will accept multiple...

read more
1 72 73 74 75 76 130