Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Powershell Plus


13 Free SQL Tools from Idera


Free Ebook: Mastering Powershell

Welcome to the archive of tips delivered through Tobias' Tip of the Day RSS Feed and Your Power Tip of the Day email. Subscribe in the sidebar to get the latest tips!

Sort by: Most Recent | Most Viewed | Most Commented
  • Using Finally for Crucial Cleanup Tasks

    PowerShell 2.0 and later In a previous tip we introduced an “acoustic progress bar” that made PowerShell play a sound for as long as it was busy. Here is the code again: # find first available WAV file in Windows folder $WAVPath = Get-ChildItem...
  • Playing WAV Files

    All Versions There is a simple way for PowerShell to play back WAV sound files: # find first available WAV file in Windows folder $WAVPath = Get-ChildItem -Path $env:windir -Filter * . wav -Recurse -ErrorAction SilentlyContinue | Select-Object -First...
  • Automating PowerShell ISE

    PowerShell 3.0 and later PowerShell ISE is completely scriptable and is accessible through the $psISE variable. This variable is present only within the PowerShell ISE. To get to the script content of the currently visible script, try this: PS> $psise...
  • Finding Process Owner

    PowerShell Version 3 or better Get-Process gets you a list of all running processes, but it will not reveal the process owner. To find the process owner, you would need to ask the WMI service, for example. To make this easier, here is a little helper...
  • Using JSON-based Web Services

    PowerShell 3 and better There are plenty of information web services out in the Internet, and many of them return results in JSON format. Here is an example that illustrates how PowerShell would query such web services, and convert the JSON results to...
  • Using Arrays as Parameter Default Values

    PowerShell 3.0 and later If you define a PowerShell function with some parameters, and you want a given parameter to have a default value that is an array, you may run into a syntax problem: function Get-SomeData { param ( $ServerID = 1 , 2 , 5 , 10 ...
  • Shorten the Prompt

    PowerShell 3.0 and later By default, PowerShell includes the current path into the prompt, and when you launch PowerShell as regular user, the current location is your user profile. That is a long path, and it is eating a lot of space. The most effective...
  • Getting DELL Warranty Information (Part 2)

    PowerShell Version 2.0 and later In a previous tip we illustrated how you can use a web service to retrieve warranty information for DELL computers. We received a lot of feedback, so before we add something new, here is the code that gets the warranty...
  • Normalizing File Extensions

    PowerShell 2.0 and later Let’s assume you want the user to submit a list of file extensions, or you are getting them from some other source. File extensions are a perfect example of fuzzy standards. How would you specify a text file extension? Is...
  • Using the PowerShell ISE Debugger

    PowerShell 3.0 and later Sometimes, it is hard to find out why a PowerShell script is not doing what it should do. To get a better understanding of what the code does, use the debugger that is built into the PowerShell ISE. Before you can debug a script...
  • Using Code Regions in ISE

    PowerShell 3.0 and later PowerShell ISE already supports collapsible code regions. When you write functions, loops, or conditions, you will notice a vertical line in the left margin with a “minus” symbol on top. Click it to collapse the region...
  • Process Killer (and some gotchas)

    PowerShell 3.0 and later In a previous tip we explained how you can turn Out-GridView into a selection dialog, and suggested a couple of ideas. One idea was to list all top level applications, and allow the user to select one, and kill it. To get all...
  • Copying Results to Clipboard

    PowerShell 3.0 and later In a previous tip we explained how you can easily copy and paste information from a grid view window produced by Out-GridView. This will not copy the column headers, though. Here is a line that you can add to any command, and...
  • Out-GridView: Universal Dialog

    PowerShell 3.0 and later By default, Out-GridView is a one-way road: you can pipe data into it and display it in a grid view window, but you cannot pass the data on. Once you add the –PassThru switch parameter, this changes, and Out-GridView displays...
  • Finding All Stoppable Services

    PowerShell 3.0 and later Get-Service lists all services installed on your computer. It has no parameter to select only running or stopped services, though. With a simple Where-Object clause, you can make up for this. Most often, you will see something...
< Previous 1 2 3 4 5 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.