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
  • Unblocking Download Files

    Any file you download from the Internet or receive via email get marked by Windows as potentially unsafe. If the file contains executables or binaries, they will not run until you unblock the file. PowerShell 3.0 and better can identify files with a "download...
  • Eliminating Empty Results

    To exclude results that have empty properties, you can easily use Where-Object. For example, when you run Get-Hotfix, and you only want to see hotfixes that have a date for InstalledOn, here is the solution: Likewise, to get only network adapters from...
  • Hidden Array Extensions in PowerShell 4.0

    PowerShell 4.0 (final version as found in Windows 8.1) has Foreach and Where built directly into arrays. This is a geek stuff, so there is no apparent advantage to it over using the traditional pipeline (except maybe for speed). This line will get only...
  • Opening Files in ISE Editor

    If you'd like to open a script in the ISE editor, one quick way is using the command "ise". For example, to open your profile script (the one that starts automatically with each ISE launch), try this: You can now easily add or remove commands...
  • Block Comment in PowerShell ISE

    Beginning in PowerShell 3.0, when you press and hold ALT and then select something, you get a block selection. If you make this selection as narrow as possible (you will only see a tiny blue line), you can now easily add or remove characters to the selection...
  • Finding Logged-On User on Remote Machine

    In a previous tip we used quser.exe to find the currently logged-on user on the local machine. Here is now a function that also allows us to find the currently logged-on user on a remote machine. As an extra benefit, the returned information is appended...
  • Finding Logged-On User

    There is a helpful console application called quser.exe which will tell you who is logged on to a machine. The executable returns plain text, but with the help of a little regular expression, this text can be converted to CSV and then imported into PowerShell...
  • Finding Logon Failures

    Whenever someone logs on with invalid credentials, there will be a log entry in the security log. Here is a function that can read these events from the security log (Admin privileges needed). It will then list all the invalid logons found in the log...
  • Change Desktop Wallpaper

    To change the current desktop wallpaper and make this change effective immediately, PowerShell can tap into the Windows API calls. Here is a function that changes the wallpaper immediately: function Set-Wallpaper { param ( [ Parameter ( Mandatory = $true...
  • Using Block Comment in the ISE Editor

    There is a little known trick that you can use to block-prepend or block-remove characters in the ISE editor. This feature was introduced in PowerShell 3.0. In the ISE editor, click to where you would like to enter something (like the start of a block...
  • Getting System Information for Remote Systems

    In a previous tip you learned how systeminfo.exe can compose a rich system profile. systeminfo.exe has built-in remoting capabilities, so provided you have the proper permissions, you can also get system information from remote systems. Here is a simple...
  • Getting System Information

    PowerShell plays friendly with existing console applications. One of the most useful is systeminfo.exe which gathers all kinds of useful system information. By importing the information provided by systeminfo.exe as CSV, PowerShell can convert the text...
  • Starting Services Remotely

    Since Start-Service has no -ComputerName parameter, you cannot use it easily to remotely start a service. While you could run Start-Service within a PowerShell remoting session, an easier way may sometimes be Set-Service. This would start the Spooler...
  • Using ICACLS to Secure Folders

    Console applications are equal citizens in the PowerShell ecosystem. In this example, a function uses icacls.exe to secure a newly created folder: function New-Folder { param ( $Path , $Username ) If ( ( Test-Path -Path $path ) -eq $false ) { New-Item...
  • Lowering PowerShell Process Priority

    When you run a PowerShell task, by default it has normal priority, and if the things your script does are CPU intensive, the overall performance of your machine may be affected. To prevent this, you can assign your PowerShell process a lower priority...
« First ... < Previous 3 4 5 6 7 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.