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
  • Listing Processes and Process Ownership

    Get-Process can list processes but does not provide information about who is running the process. Here, WMI can help. Get-ProcessEx is a clever function that returns process information including ownership, and it works remotely, too. So if you wanted...
  • Creating Scheduled Tasks From XML

    In a previous tip, we showed how you can export a scheduled task to an XML file. Now, it's time to see how you can re-import that XML file to re-create the scheduled task. Before you can use this tip, you need an XML definition for a task. Check out...
  • Output Scheduled Tasks to XML

    Here's an easy way how you can export and dump a task that you created in "Scheduled Tasks" to XML: function Export-ScheduledTask { param ( [ Parameter ( Mandatory = $true )] $TaskName , [ Parameter ( Mandatory = $true )] $XMLFileName )...
  • Use Internet Connection with Default Proxy

    If you want PowerShell to use the same proxy settings that are set in your Internet Explorer browser, then here's the code you need: $proxy = [ System.Net.WebRequest ] :: GetSystemWebProxy () $proxy . Credentials = [ System.Net.CredentialCache ] ...
  • Converting Bitmaps to Icons

    If you need a new icon and have no icon editor at hand, then you can take a bitmap file (create one with MS Paint if you must) and have PowerShell convert it into an icon file. The function code also illustrates how you can open an Explorer window and...
  • Finding Numbers in Text

    Regular Expressions are a great help in identifying and extracting data from text. Here's an example that finds and extracts a number that ends with a comma: PS > $text = "I am looking for a number like this 67868683468932689223479, that is...
  • Verbose Driver Information

    In a previous tip you discovered driverquery.exe to list driver information. This tool sports a /V switch for even more verbose information. However, due to localization errors, when you specify /V, column names may no longer be unique. That's when...
  • Making Names Unique

    To make a list of items or names unique, you could use grouping and then, when a group has more than one item, append a numbered suffix to these items. Here's a simple example: function Convert - Unique ( $list ) { $list | Group-Object | ForEach-Object...
  • Home-Made Driver Query Tool

    Some months ago we introduced to you the driverquery.exe tool and how to convert its output to PowerShell objects. Here's now an amazing function that turns this command-line tool into a graphical tool that lists drivers from both local and remote...
  • Checking Text Ending with Wildcards

    In a previous tip you learned how to use the string method EndsWith() to check whether a text ends with certain characters. This method does not accept wildcards, though. So to check text endings for patterns, try this approach instead: PS > "Account123"...
  • Checking if a Text Ends with Certain Characters

    You can always use the String method EndsWith(). Just make sure you convert the text to lower-case first to avoid case-sensitive comparison. This will check whether the file name ends with '.pdf': PS > "somefile.PdF" . toLower ()...
  • Counting Log Activity Based On Product Install

    In a previous tip you learned how to use Group-Object to analyze text-based log files. Here's a refined snippet. It will count on which days your Windows box received the most updates: Get-Content $env:windir\windowsupdate.log | Where-Object { $_...
  • Counting Log Activity

    Did you know that Group-Object can analyze text-based log files for you? Here's sample code that tells you how many log entries on a given day a log file contains: Get-Content $env:windir\windowsupdate.log | Group-Object { $_ . SubString ( 0 , 10...
  • Shrinking Paths

    Many file-related .NET Framework methods fail when the overall path length exceeds a certain length. Use low-level methods to convert lengthy paths to the old 8.3 notation which is a lot shorter in many cases: function Get - ShortPath ( $Path ) { $code...
  • Output to Console AND Variable

    To assign results to a variable and at the same time view these results in your console, place the assignment operation into parenthesis: ( $result = Get-Process ) As you will see, the processes will still appear in your console. At the same time, they...
« First ... < Previous 72 73 74 75 76 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.