Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

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
  • Playing WAV files

    PowerShell can play WAV files, so you can add sound and special effects to your scripts (provided your system has a sound card): PS > $player = New-Object System.Media.SoundPlayer " $env:windir\Media\notify.wav " PS > $player . Play (...
  • Creating a "Better" More

    In a previous tip you learned that using "more" to paginate output can be dangerous, and instead you should use Out-Host -Paging. To "update" more.com and make it behave like Out-Host with the -Paging parameter set, use a proxy function...
  • Using "Elevator Music" In Your Scripts

    Maybe you'd like to give some feedback to the users of your script while it processes a long-running task. One of the easiest (and most annoying) types of feedback is to play some "elevator music". Here's how: function Start-ElevatorMusic...
  • Getting Windows Product Key

    Ever wanted to read out the Windows license key? In the Windows Registry, this key is present, but it is stored as a digital ID. To convert it back to the license key used to originally license the product, try this function. It uses some serious math...
  • Getting Network Adapter Settings

    To view the configuration details of a network adapter, you can specify the network adapter connection ID as it appears in your control panel. By linking the WMI result to the corresponding Win32_NetworkAdapterConfiguration class, you get to the actual...
  • Combining Network Adapter Information

    In a previous tip you learned that WMI network adapter information is separated into two classes. Win32_NetworkAdapter represents the hardware, and Win32_NetworkAdapterConfiguration contains the configuration details. To mix information from both classes...
  • Setting Mouse Position

    PowerShell can place the mouse cursor anywhere on your screen. Here's the code: [ system.Reflection.Assembly ]:: LoadWithPartialName ( "Microsoft.Forms" ) | Out-Null [ System.Windows.Forms.Cursor ]:: Position = New-Object System.Drawing...
  • Get All Logged On Users

    In a previous tip, you learned how to determine who the user is logged onto the physical machine. However, this will not discover logged-on terminal service users or users inside virtual machines. You must use the code below to find those: $computername...
  • Find Latest Processes

    You should try this piece of code to find all processes that were started within the past 10 minutes: Get-Process | Where-Object { try { ( New-Timespan $_ . StartTime ) . TotalMinutes -le 10 } catch { $false } } This will only cover processes that you...
  • Adding Protection to Functions

    Functions that you define are read/write and can easily be overwritten. You can set the read-only attribute to make a function read-only so that you get a warning if you try to overwrite it. This line sets the read-only attribute for a function named...
  • Test whether Registry Value exists

    You should remember that registry values are treated like properties to a registry key so they have no specific path and you cannot use Test-Path to check whether a given registry value exists. Here is a function you can use instead: Function Test-RegistryValue...
  • Exchange 2010 Compiled Help

    Want to learn about all the new Exchange 2010 cmdlets? You can download the compiled Help file from Microsoft: http://www.microsoft.com/downloads/details.aspx?FamilyID=045f7af5-b226-4a05-8ace-4e17cfdef856&displaylang=en ReTweet this Tip!
  • Comparing Results

    PowerShell makes it easy to compare results and find only things that changed. For example, you may want to list only processes that started after a given time. To do that, first create the initial snapshot of running processes. Then, at a later time...
  • Stopping and Disabling Services

    You may find that Vista's new Instant Search can sometimes get out of hand and slow down your machine. Temporarily disabling and then stopping the search service is one way to deal with this issue: Set-Service wsearch -startupType Disabled Stop-Service...
  • Changing Execution Policy without Admin Rights

    In PowerShell v.2, a number of parameters have been added to Set-ExecutionPolicy, which allows you to change this setting without Admin privileges, unless an administrator has restricted this: This line will change the execution policy only for the current...
« First ... < Previous 3 4 5 6 7 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.