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
  • Using Splatting

    With splatting, you can call cmdlets and programmatically control the parameters you submit. To do this, add the parameters and values to a hash table, then submit the hash table to the cmdlet. This works with any cmdlet. Here is an example: # classic...
  • Reading RSS Feeds

    RSS feeds can be read by using an XML object, however XML objects do not support proxies. Here is an example that uses Invoke-WebRequest to retrieve the RSS data via proxy (or directly if you omit the proxy parameters), then converts the results to XML...
  • Getting Registry Values and Value Types

    Get-ItemProperty can easily read registry values, but you do not get back any information about the registry value type. Get-ItemProperty -Path ' HKLM:\Software\Microsoft\Windows NT\CurrentVersion ' Here is an alternate approach that uses .NET...
  • Finding Information about TV Series

    PowerShell can query websites that deliver XML content, and here is an example on how to query a movie database. Simply adjust the name of the TV series you are interested in. Optionally, use the parameter for a proxy if you have no direct Internet access...
  • Comparing Folder Content

    To quickly compare folder content and find out files that exist only in one of two folders, try this example: $list1 = Get-ChildItem c:\Windows\system32 | Sort-Object -Property Name $list2 = Get-ChildItem \\ server12 \ c $\ windows \ system32 | Sort-Object...
  • Bulk Renaming Files

    Let's assume you have a folder full of picture files, and you'd like to standardize naming. Here is a script illustrating how you can do a bulk rename: $i = 0 Get-ChildItem -Path c:\pictures -Filter * . jpg | ForEach-Object { $extension = $_ ...
  • Encoded Passwords

    If you must put a credential object in your script, here is a way how you can convert a secure string into encrypted text: $password = Read-Host -Prompt ' Enter Password ' -AsSecureString $encrypted = $password | ConvertFrom-SecureString $encrypted...
  • Find All Active Drive Letters

    To quickly get a list of all drive letters in use, try this: #requires -Version 1 [ Environment ] :: GetLogicalDrives () The result is a list of all active drive letters: PS> C:\ D:\ E:\ F:\ G:\ ReTweet this Tip!
  • Encrypting Text Information Using Passphrase

    PowerShell 3.0 and later In a previous tip we explained how you can use the Windows product ID stored in the Windows Registry to encrypt some text information. If you find that this publicly available information is not safe enough for your purpose, then...
  • Encrypting Information with Windows ProductID

    PowerShell 3.0 and later To store secret information, you can use a SecureString object and save it to disk. PowerShell automatically takes the user account as a secret key, so only the user who saved the information can retrieve it. If you want to bind...
  • Finding Exchange Mailboxes

    Microsoft Exchange 2013 To find the number of mailboxes, simply use the Exchange cmdlets and have Measure-Object count the results: Get-Mailbox – ResultSize Unlimited | Measure-Object | Select-Object -ExpandProperty Count Likewise, to find all shared...
  • Clever Parameter Validation

    PowerShell 2.0 and later When you create PowerShell functions with parameters, make sure you tell PowerShell what kind of values the parameter expects. In a simple example, you could ask for a weekday: function Get-Weekday { param ( $Weekday ) "You...
  • Discovering High Impact Cmdlets

    All Versions Cmdlets can declare how severe their impact is. Typically, cmdlets that make changes to the system that cannot be undone will have an “Impact Level” of “High”. When you run such a cmdlet, PowerShell will automatically...
  • ISE Auto-Completion Trick

    PowerShell 3.0 ISE and later When you want to select the information returned by a cmdlet, you typically use Select-Object: Get-Process | Select-Object -Property Name , Company , Description However, you would have to manually enter the property names...
  • Accessing Non-Microsoft LDAP Servers

    All Versions There are free Active Directory cmdlets from Microsoft (part of the RSAT tools) and Dell (Quest). They take the complexity out of accessing a domain controller, and ask for information. To access a non-Microsoft LDAP server, while there are...
1 2 3 4 5 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.