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
  • Getting Free Cheat Sheets

    There are two great sources for PowerShell cheat sheets. One is the set of cheat sheets created by powershellmagazine.com which was just updated to cover PowerShell 4.0 and now also includes a sheet for Desired State Configuration (DSC). You can download...
  • Start to Look at DSC

    Desired State Configuration (DSC) is a new feature in PowerShell 4.0. With DSC, you can write simple configuration scripts and apply them to the local or a remote machine. Here is a sample script to get you started: Configuration MyConfig { # Parameters...
  • Compiling Binary Cmdlets

    PowerShell functions can mimick all the features found in a true binary cmdlet--but PowerShell functions are plain PowerShell code, so anyone can view it. If you are a developer and interested in creating binary cmdlets, here is a quick starter. It illustrates...
  • Adding and Resetting NTFS Permissions

    Whether you want to add a new NTFS access rule to a file or turn off inheritance and add new rules, here is a sample script that illustrates the trick and can serve you as a template. The script creates a test file, then defines a new access rule for...
  • Converting Text Arrays to String

    Occasionally, text from a text file needs to be read and processed by other commands. Typically, you would use Get-Content to read the text file content, then pass the result on to other commands. This may fail, though. And here is the caveat: Always...
  • ISE Bug Locks Debugger

    There is an obscure bug in the PowerShell ISE that may dead-lock the debugger. It affects PowerShell version 3.0 and 4.0. Here is a test script: $test = @" Some lines of text "@ $test Save this code as a script in your ISE editor, then set a...
  • Bulk Renaming Object Properties

    Occasionally, it may become necessary to bulk rename object properties to create better reports. For example, if you retrieve process objects, you may need to create a report with column headers that are different from the original object properties....
  • Fixing Display in Excel Reports

    When you send information to Microsoft Excel, it is converted to text using the built-in .NET ToString() method. This method typically does not convert well any arrays or non-primitive data types. Here is an example illustrating the problem. It creates...
  • Creating Excel Reports

    PowerShell objects can easily be opened in Microsoft Excel. Simply export the objects to CSV, then open the CSV file with the associated program (which should be Excel if it is installed). This creates a report of running processes and opens in Excel...
  • PowerShell does not support JSON Data Types

    By default, any object created from JSON uses String as a data type: $json = @" { "Name": "Weltner", "ID" : "123" } "@ $info = ConvertFrom-Json -InputObject $json $info . Name $info . ID JSON does support...
  • Use JSON to Create Objects

    JSON is describing objects, similar to XML--but a lot easier. JSON allows for nested object properties, so you can retrieve information from various sources and consolidate them into one custom object. Have a look. This creates an inventory item containing...
  • Getting Variable Value in Parent Scope

    If you define variables in a function, then these variables live in function scope. To find out what the value of the variable is in the parent scope, use Get-Variable with the parameter -Scope: $a = 1 function test { $a = 2 $parentVariable = Get-Variable...
  • Updating Windows Defender Signatures

    Windows 8.1 comes with a ton of new cmdlets. One of them can automatically download and install the latest antivirus signatures for Windows Defender: Get-MpComputerStatus returns information about the state of your signatures. These cmdlets are not part...
  • Automation via Keystroke and Mouse Click

    Occasionally, the only way of automating processes is to send keystrokes or mouse clicks to UI elements. A good and free PowerShell extension is called "WASP" and is available here: http://wasp.codeplex.com/ Once you install the module (do not...
  • Showing WPF Info Message

    WPF (Windows Presentation Foundation) is a technology that enables you to create windows and dialogs. The advantage of WPF is that the window design can be separated from program code. Here is a sample that displays a catchy message. The message is defined...
« First ... < Previous 2 3 4 5 6 Next > ... Last »
Copyright 2012 PowerShell.com. All rights reserved.