February 2011 - Power Tips

Share |

Join PowerShell.com!
Subscribe to Feed

PowerShell eBook
Sign up for
Your PowerTip of the Day:

Award-winning PowerShellPlus


Admin Guide to PowerShell Remoting


Mastering PowerShell eBook

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
  • Storing a Picture in Active Directory

    When you need to store a picture into an AD account, the picture will have to be converted to byte values before it can be stored. Just make sure you adjust the path to the picture you want to store and the LDAP path of the AD object you want the picture...
  • Finding Out Video Resolution

    You can use this function if you would like to check the current video resolution on a local or remote system: function Get-Resolution { param ( [Parameter(ValueFromPipeline = $true )] [Alias( "cn" )] $ComputerName = '.' ) process {...
  • Sending Magic Packet

    You can also send a "magic packet" with the machines MAC address if you'd like to wake up a machine,. Here is how to send such a packet-- just make sure you adjust $mac to the MAC address your machine is using. $mac = [ byte []](0x00, 0x11...
  • Finding MAC Addresses

    You can use the network adapter MAC address to wake a computer. Use this line if you want to find the MAC addresses of your network adapters: Get-WmiObject Win32_NetworkAdapter | Where-Object { $_ . MacAddress } | Select-Object Name, MacAddress ReTweet...
  • Getting List of Exchange Rates

    In a previous tip, you learned how to read current exchange rates from the Internet., you can easily create a comprehensive list of all exchange rates by using a hash table: $xml = New-Object xml $xml . Load ( 'http://www.ecb.europa.eu/stats/eurofxref...
  • Getting Up-to-Date Exchange Rates

    If you would like to get currency exchange rates, you can simply access a Web service from one of the major banks. Here is how to get the USD exchange rate: $xml = New-Object xml $xml . Load ( 'http://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily...
  • Finding 32-Bit Processes

    Did you know that on a 64-bit machine that not all processes are 64-bit? You can use this little trick to filter out only 32-bit processes: Get-Process | Where-Object { ( $_ | Select-Object -ExpandProperty Modules -ea 0 | Select-Object -ExpandProperty...
  • Getting Port Connectors

    WMI can retrieve all kinds of information about your computer configuration. However, the information is often coded. Consider using hash tables to translate numbers to clear text: f function Get-PortConnector { $connectiontype = @ ' Unknown Other...
  • Get Installed Software

    You can get a list of installed software right from the registry as long as the target system runs PowerShell v2 and is set up for PowerShell Remote, which also works for remote machines. When you run Get-InstalledSoftware, it will return the locally...
  • Accessing Registry Remote

    If you need to access registry keys and values on another machine, you can either use PowerShell Remote (requires PowerShell v2 on the remote machine), or you can use good old DCOM. Here is how: # NOTE: RemoteRegistry Service needs to run on target system...
  • Reading Password Age

    When you want to find out the password age of Active Directory accounts, you can use this piece of code: function Get-PwdAge { $filter = '(&(objectCategory=person)(objectClass=user))' $root = New-Object System.DirectoryServices.DirectoryEntry...
  • Reading Twitter News

    Have you ever wanted to stay updated on Twitter news? You just need three lines of code to return the latest 100 Twitter entries related to PowerShell: $xml = New-Object xml $xml . load ( "http://search.twitter.com/search.atom?q=powershell&rpp...
  • Control Media Player from PowerShell

    Start your day with your favorite music or playlist by controlling Media Player by PowerShell. Get-MediaPlayerItems will return all playlists and multimedia items accessible. Start-MediaPlayer accepts any one of them and will launch Media Player to play...
  • Getting Non-Expiring Passwords

    You should use a searcher object like this if you need to find all user accounts in your Active Directory with non-expiring passwords: function Get-NonExpiringPasswords { $filter = '(&(objectCategory=person)(objectClass=user)(userAccountControl...
  • Validating Input

    You can also use regular expressions to validate user input. For example, the following piece of code only accepts three seven digit numbers: do { $result = Read-Host "3-7-digit number" $result = $result . Trim ( "0" ) } while ( $result...
1 2 Next >
Copyright 2012 PowerShell.com. All rights reserved.