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
  • Bringing Window in the Foreground

    PowerShell can use Add-Type to access internal Windows API functions. This way, it is easy to bring any process window into the foreground. Here is the function you need: #requires -Version 2 function Show-Process($Process, [ Switch ] $Maximize ) { $sig...
  • Process Data (Part 3)

    In parts 1 and 2, you learned how a PowerShell function can process information that was submitted to parameters or piped via the pipeline. In our third part, we'd like to show how a function can receive text lines and produces one string from it...
  • Process Data (Part 2)

    In part 1 we showed how a PowerShell function can receive input both from a parameter and via the pipeline, and process it in real-time. This is the most efficient way as it minimizes memory consumption. Sometimes, however, it is necessary to first collect...
  • Processing Data (Part 1)

    This is the first of the three tips showing you how a PowerShell function can accept data via pipeline or parameter. In part 1, the function processes the incoming information in real-time. This minimizes memory consumption and provides rapid results...
  • Get UI Information for Processes

    PowerShell can use UIAutomation calls to find out useful UI information about any process. You can find out whether a process accepts keyboard input, whether it is currently visible (and what its window dimensions are), and whether it is a native Win32...
  • PowerShell 5.0 RTM (was) available

    Shortly before Christmas, PowerShell 5.0 RTM was made available to all Windows versions down to Windows 7: http://blogs.msdn.com/b/powershell/archive/2015/12/16/windows-management-framework-wmf-5-0-rtm-is-now-available.aspx . Unfortunately, there was...
  • Compressing to ZIP Files

    In PowerShell 5.0, Compress-Archive can easily compress files and folders to a ZIP file: PS C:\> Compress-Archive -Path c:\sourcefolder -DestinationPath $env:temp\archive.zip -Force Compress-Archive is not a cmdlet, though. It is a function and leverages...
  • Quickly Scanning for Malware

    If you have Windows Defender installed on your machine, you can use this PowerShell command to run a quick scan on a drive of your choice: PS> Start-MpScan -ScanType QuickScan -ScanPath “C:” This command requires the "Defender"...
  • Enabling Telnet Client and Watching Star Wars

    By default, the Telnet client is disabled on Windows systems. You can easily enable it with a one liner in PowerShell, though. Just launch a PowerShell with full Administrator privileges, then run this command: PS C:\> dism /online /Enable-Feature...
  • Enabling PowerShell Remoting with NTLM

    By default, PowerShell remoting uses Kerberos authentication and works only in domain environments, and only when you specify computer names, not IP addresses. To use PowerShell remoting in other scenarios such as peer-to-peer networks at home or in labs...
  • Validate Read-Host Input

    Beginning in PowerShell 4.0, you can use validators for variable assignments. This gives you a quick and easy way of validating user input, too. The next line accepts only user input that matches the regular expression in the validator. It only accepts...
  • Restore PowerShell ISE Defaults

    To restore custom settings in PowerShell ISE to factory defaults, try running these lines: $PSise . Options . RestoreDefaults () $PSise . Options . RestoreDefaultConsoleTokenColors () $PSise . Options . RestoreDefaultTokenColors () $PSise . Options ....
  • Fixing Remoting Bug

    Have you ever tried to enable PowerShell remoting with Enable-PSRemoting, and just got an error complaining about not being able to check the current firewall status? On Windows 7 machines, this may be due to a bug explained here: https://support.microsoft...
  • Refreshing Icon Cache

    Sometimes, Windows Explorer does not show correct icons. When you update to PowerShell 5.0, for example, both PowerShell and PowerShell ISE got new and modern icons. If you still see the old icons, it may be time to refresh the icon cache. Here is a function...
  • Formatting Text Output

    If you need to return multiple items in a nicely formatted text report, here is a simple trick: get yourself an ordered hash table (supported in PowerShell 3.0 or better), assign the items you want to output, and then convert it into an object. This object...
1 2 3 4 5 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.