Powershell

Unfolding Object Data Structure

PowerShell 3.0 and later Objects can contain nested properties, and the data you are after may be “somewhere” inside an object. To...

Suppress Confirmation

All PowerShell Versions Some cmdlets (like Remove-ADGroupMember) automatically ask for confirmation. This can be a problem in scripts running...

Getting Cmdlet Help No Matter What

PowerShell 3.0 and later Beginning in PowerShell 3.0 PowerShell no longer ships its help files. Instead, you need to download them via Update-Help,...

Automating PowerShell ISE

PowerShell 3.0 and later PowerShell ISE is completely scriptable and is accessible through the $psISE variable. This variable is present only within...

Finding Process Owner

PowerShell Version 3 or better Get-Process gets you a list of all running processes, but it will not reveal the process owner. To find the process...

Using JSON-based Web Services

PowerShell 3 and better There are plenty of information web services out in the Internet, and many of them return results in JSON format. Here is an...

Using Arrays as Parameter Default Values

PowerShell 3.0 and later If you define a PowerShell function with some parameters, and you want a given parameter to have a default value that is an...

Shorten the Prompt

PowerShell 3.0 and later By default, PowerShell includes the current path into the prompt, and when you launch PowerShell as regular user, the...

Normalizing File Extensions

PowerShell 2.0 and later Let’s assume you want the user to submit a list of file extensions, or you are getting them from some other source....

Using the PowerShell ISE Debugger

PowerShell 3.0 and later Sometimes, it is hard to find out why a PowerShell script is not doing what it should do. To get a better understanding of...

Using Code Regions in ISE

PowerShell 3.0 and later PowerShell ISE already supports collapsible code regions. When you write functions, loops, or conditions, you will notice a...

Process Killer (and some gotchas)

PowerShell 3.0 and later In a previous tip we explained how you can turn Out-GridView into a selection dialog, and suggested a couple of ideas. One...

Out-GridView: Universal Dialog

PowerShell 3.0 and later By default, Out-GridView is a one-way road: you can pipe data into it and display it in a grid view window, but you cannot...

Finding All Stoppable Services

PowerShell 3.0 and later Get-Service lists all services installed on your computer. It has no parameter to select only running or stopped services,...

Exporting Out-GridView Content

PowerShell 3.0 and later Out-GridView is a very useful cmdlet to output results to an extra window. Unlike outputting to the console, Out-GridView...

Getting a Clean PowerShell Environment

PowerShell 3.0 and later When you develop PowerShell scripts in the PowerShell ISE, you will probably make a lot of changes and revisions, and...

Find AD Replication Failures

Windows 8.1, Server 2012 R2 Investigating Active Directory replication failures becomes easy with Windows 8.1 and Server 2012 R2. A new cmdlet...

Useful Static .NET Methods

All Versions PowerShell can access static methods of .NET types. Here are some real world one-liners that can do a lot for you: [Math]::Round(7.9)...

Mandatory Parameters with a Dialog

All Versions Typically, when you declare a parameter as mandatory, and the user does not submit it, PowerShell takes care and prompts the user for...

Use Open File Dialog

All PowerShell versions To add some sophistication to your script, here is a simple function that opens the OpenFile dialog and lets the user pick a...

Managing Terminal Service Settings

ActiveDirectory Module Sometimes you may want to directly access properties related to the terminal service in an Active Directory account. Here is...

Credential Obfuscator

PowerShell ISE 3.0 and later While it is generally not recommended to hard code passwords in scripts, there are sometimes scenarios where this is...

Copying Command Line History

All PowerShell versions To preserve all the PowerShell commands that you entered in a PowerShell session, check out this one liner:...

Getting Computer Serial Number

All PowerShell versions In a previous tip we illustrated how you can take a DELL serial number and check online the warranty status. Other vendors...

1 53 54 55 56 57 104