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

Archives

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
  • Formatting XML Files

    Here's a cool little XML formatting tool. It takes the path to any XML file and allows you to specify an indent. Then, it saves the file as new XML file with the indentation you specified. Here's the code for the function: function Format-Xml...
  • Get .NET Runtime Directory

    Ok, this is more for the developers. To find out where your .NET Runtime folder is, try this line: PS > $path = [ System.Runtime.InteropServices.RuntimeEnvironment ] :: GetRuntimeDirectory () PS > $path C:\Windows\Microsoft.NET\Framework64\v4.0...
  • Communicating Between Multiple PowerShells via UDP

    Assume you want to send some information to another PowerShell session, or you'd like to have one session wait until another is ready. Here are two simple functions that allow you to send and receive text information across PowerShell sessions using...
  • Custom Formatting DateTimes

    In a previous tip we published the list of placeholders to define datetime patterns. You can use the very same placeholders to define your own datetime output formats, too. Check out these examples: PS > Get-Date -format ' d MMM yyyy ' 30 Mar...
  • Parsing Custom DateTime Formats (Part 2)

    In a previous tip we illustrated how you can use ParseExact() to parse custom datetime formats. This only works though if the date and time information does not contain extra characters except whitespace. To parse date and time information that has extra...
  • Parsing Custom DateTime Formats

    Sometimes, date and time information may not conform to standards, and still you'd like to interpret that information correctly as date and time. That's when you can use ParseExact() provided by the DateTime type. Here's an example: PS >...
  • Parsing Date and Time

    Parsing a date and/or time information is tricky because formatting depends on the regional settings. This is why PowerShell can convert date and time based on your regional settings or in a culture-neutral format. Let's assume this date: PS >...
  • Comparing Services in PowerShell

    Compare-Object is one of the most widely ignored most powerful cmdlet around. It can compare results and figure out differences. For example, if you'd like to know the differences in service configuration between two machines, here's the simple...
  • Map Network Drive

    Sure you can use the command net use to map a network drive. But this would not check for existing mapped drives. Here's a small function that first checks to see that the URL you are mapping to does not yet exist, avoiding duplicate mapped drives...
  • 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...
  • Mapping Printers Part 2

    In a previous tip we explained how you can install and map printers remotely using a low level command: rundll32 printui.dll , PrintUIEntry /in /n "\\pntsrv1\HP552" This will map the printer share and also install drivers if required. A dialog...
  • 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...
  • Sharing Folders

    Console commands are first class PowerShell citizens, so sometimes it may be easier to use classic console commands to solve a problem. Here is a function that creates a local folder and also shares it so others can use it via network. Just be aware that...
  • Executing PowerShell on Computer Lock

    PowerShell can respond to system events such as locking or unlocking a session. Here is a fun sample. Provided you have your sound card turned on, your computer will say good-bye when you press WIN+L and welcome you back when you log on again: function...
  • Sending Email to Multiple Recipients

    Send-MailMessage can send emails to multiple recipients. You just need to make sure the list of recipients is provided as an array. When you call Send-MailMessage via command line, that's a no-brainer. Simply use a comma-separated list: PS > Send...
« First ... < Previous 72 73 74 75 76 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.