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
  • Check Active Internet Connection

    If your machine is connected to the Internet more than once, let's say cabled and wireless at the same time, which connection is used? Here's a function that tells you (thanks for inspiration to fellow MVP Richard Siddaway): function test-ipmetric...
  • Use WMI and WQL!

    WMI is a great information resource, and Get-WmiObject makes it easy to retrieve WMI instances. First, use -List parameter to find WMI class names. For example, find classes that deal with network: Get-WmiObject -List Win32_ * network * Next, pick one...
  • Convert to Numeric

    Whenever PowerShell asks for user input or reads text file content, the results are text strings. If you expect numbers and want to calculate, make sure you cast them to a numeric format. Have a look: PS > $number = Read-Host ' Enter a number '...
  • Read/Delete/Move Every X. File

    Occasionally, you may want to act on every 2nd or 3rd file in a folder (or line in a file). The easiest way to identify every x. element is to use the "%" (modulus) operator. This will list every 5th file in the Windows folder (for what it's...
  • Managing Internet Cookies

    Ever wondered what Internet sites store inside cookies when you visit them? This line will dump all cookies: PS > dir ([ system.environment ] :: GetFolderPath ( ' Cookies ' )) Cookies are text files. In older versions of IE, the file name contains...
  • Create Own Driver Tool

    Thanks to Peter Bishop, here's an enhancement to one of our earlier tips. It turns the command line output delivered by driverquery.exe into a nice info window. Driverquery.exe /v /FO CSV | ConvertFrom-Csv | Select-Object ' Display Name '...
  • Ignoring Empty Lines

    To read in a text file and skip blank lines, try this: $file = ' c:\sometextfile.txt ' Get-Content $file | Where-Object { $_ . Trim () -ne '' } It will omit empty lines, lines with only blanks and lines with only tabs. ReTweet this Tip...
  • Removing Characters at the Beginning of Text

    To remove text at the beginning of a sentence rather than somewhere inside the sentence, use the operator -replace and the anchor '^'. Check out the difference: PS > ' PC101 is the PC we are overhauling ' -replace ' PC ' , ''...
  • HTML Reporting: Create a System Report

    In a previous tip you learned how WMI can deliver system profile information. Let's take this data and turn it into a HTML report. Here's a function Get-SystemReport that creates the HTML for local and/or remote systems (provided you have remote...
  • Creating System Footprints

    WMI can retrieve a lot more object instances than you might think. If you submit a parent class, Get-WmiObject returns all instances of all derived classes. That's why a simple line like the following can get you all hardware-related instances: PS...
  • Retrieve Exchange Rates

    If you need up-to-date exchange rates, try loading the rates via XML from the European Central Bank. This sample gets you the latest exchange rates for USD-EUR conversion. It also has a link to other currency data. Just exchange the data link. We included...
  • Bulk-Creating PDF Files from Word

    To convert a whole folder full of MS Word documents to PDF, here's a function that might help:/p> function Export-WordToPDF { param ( [ Parameter ( Mandatory = $true , ValueFromPipelineByPropertyName = $true )] [ Alias ( "FullName" )...
  • Reading the Clipboard

    What if you wanted to paste information from the clipboard? No sweat, here is a Get-Clipboard function that outputs any text held by the clipboard: function Get-Clipboard { Add-Type -AssemblyName System.Windows.Forms $tb = New-Object System.Windows.Forms...
  • Sending Text to Clipboard Everywhere

    In a previous tip you learned how to use clip.exe to send results to the clipboard. But what if you don't have clip.exe (let's say on Windows XP) or don't want dependencies? Here's a clever alternative: function Out-Clipboard { param ...
  • Sending Text to the Clipboard

    Wouldn't it be fun if you could send results directly to the clipboard? Well, beginning with Windows Vista you can - thanks to clip.exe: PS > Get-Process | clip.exe This may look strange but works, and when you paste the result into an editor,...
« First ... < Previous 59 60 61 62 63 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.