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
  • Renaming Object Columns

    In some of our previous tips, we showed how you can turn comma-separated data returned from different console tools into rich PowerShell objects. You also learned how you can access the columns in a culture-neutral way. Today, we'd like to present...
  • Deleting Certificates

    If you want to permanently delete a digital certificate in your certificate store, here is how. This line lists all your personal certificates: PS > Get-ChildItem cert:\CurrentUser\My To get rid of a certificate, use this code (Warning: deleting certificates...
  • Normalizing Localized Data

    Many console-based tools like driverquery , whoami , or tasklist provide useful information but the column names are localized and may differ, depending on the language your system uses. One way of accessing columns regardless of localization: access...
  • Finding Process Owners and Sessions

    Get-Process returns a lot of information about running tasks but it does not return the process owners or the session a process is logged on to. There are built-in console tools like tasklist that do provide this information. By asking these tools to...
  • Easier Parameter Attributes in PowerShell v3

    In PowerShell v2, to declare a function parameter as mandatory, you would decorate the parameter like this: param ( [ Parameter ( Mandatory = $true )] $p ) in PowerShell v3 , those attributes default to $true , so you get away with : param ( [ Parameter...
  • Exploring Group Membership

    To find out the groups your account belongs to, there is a command line tool called whoami . This tool supports options to output the information as comma-separated values. PowerShell can pick up CSV data and convert it to real objects. So with one simple...
  • Installing PowerShell v3 Help

    PowerShell v3 comes without help files. To get help, you need to download the help files first. In an elevated PowerShell console, use this command: PS > Update-Help -Force Currently, help is available only on English systems. To use English help on...
  • Controlling PSComputerName in Remoting Data with PowerShell

    Whenever you use Invoke-Command to remotely execute code, you will notice that PowerShell automatically adds the column PSComputerName to your results. That's great because when you run Invoke-Command against more than one computer, you want to still...
  • Listing Windows Updates with PowerShell

    There is a not widely known COM object that you can use to list all the installed Windows Updates on a machine. Here is the code: $Session = New-Object -ComObject Microsoft.Update.Session $Searcher = $Session . CreateUpdateSearcher () $HistoryCount =...
  • Determine Functions Pipeline Position with PowerShell

    Assume your function wanted to know whether it is the last element in a pipeline or operating in the middle of it. Here is a way for a function to determine its current pipeline position: function test { param ( [ Parameter ( ValueFromPipeline = $true...
  • Displaying Balloon Tips with PowerShell

    Let's assume your script wants to share status information via a balloon message in the system tray area. Here is a sample: [ system.Reflection.Assembly ] :: LoadWithPartialName ( ' System.Windows.Forms ' ) | Out-Null $balloon = New-Object...
  • Extracting Icons with PowerShell

    To extract an icon from a file, use .NET Framework methods. Here is a sample that extracts all icons from all exe files in your Windows folder (or one of its subfolders) and puts them into a separate folder: [ System.Reflection.Assembly ] :: LoadWithPartialName...
  • Saving History to Script with PowerShell

    PowerShell is all about trial and error, and when you want to save your interactive input to a script file, this is how it could be done: Get-History -Count $MaximumHistoryCount | ForEach-Object { $_ . CommandLine | Out-File $env:temp\myscript.ps1 -Append...
  • Forwarding Selected Parameters with PowerShell

    In a previous tip you learned how you can forward function parameters to cmdlets. But what if you just want to forward some of the parameters? Here is a sample: function Get - BIOS ( $ComputerName , $Credential , [ switch ] $Verbose ) { $a = $global:psboundparameters...
  • Clean Your Temp Folder with PowerShell

    When disk space gets low, you may want to clean up your temporary folder. The code deletes all files that are older than 30 days to make sure you're not dumping anything that's still needed: $cutoff = ( Get-Date ) - ( New-TimeSpan -Days 30 ) ...
« First ... < Previous 57 58 59 60 61 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.