Send-MailMessage can send emails to multiple recipients. You just need to make sure the list of recipients is provided as an array. When you call...
database-tools
Adding Progress to Long-Running Cmdlets
Sometimes cmdlets take some time, and unless they emit data, the user gets no feedback. Here are three examples for calls that take a long time...
Killing Long-Running Scripts
You can use a background thread to monitor how long a script is running, and then kill that script if it takes too long. You can even write to an...
Listing Processes and Process Ownership
Get-Process can list processes but does not provide information about who is running the process. Here, WMI can help. Get-ProcessEx is a clever...
Creating Scheduled Tasks From XML
In a previous tip, we showed how you can export a scheduled task to an XML file. Now, it's time to see how you can re-import that XML file to...
Output Scheduled Tasks to XML
Here's an easy way how you can export and dump a task that you created in "Scheduled Tasks" to XML: function Export-ScheduledTask {...
Use Internet Connection with Default Proxy
If you want PowerShell to use the same proxy settings that are set in your Internet Explorer browser, then here's the code you need: $proxy =...
Converting Bitmaps to Icons
If you need a new icon and have no icon editor at hand, then you can take a bitmap file (create one with MS Paint if you must) and have PowerShell...
Finding Numbers in Text
Regular Expressions are a great help in identifying and extracting data from text. Here's an example that finds and extracts a number that ends...
Verbose Driver Information
In a previous tip you discovered driverquery.exe to list driver information. This tool sports a /V switch for even more verbose information....
Making Names Unique
To make a list of items or names unique, you could use grouping and then, when a group has more than one item, append a numbered suffix to these...
Home-Made Driver Query Tool
Some months ago we introduced to you the driverquery.exe tool and how to convert its output to PowerShell objects. Here's now an amazing...
Checking Text Ending with Wildcards
In a previous tip you learned how to use the string method EndsWith() to check whether a text ends with certain characters. This method does not...
Checking if a Text Ends with Certain Characters
You can always use the String method EndsWith(). Just make sure you convert the text to lower-case first to avoid case-sensitive comparison. This...
Counting Log Activity Based On Product Install
In a previous tip you learned how to use Group-Object to analyze text-based log files. Here's a refined snippet. It will count on which days...
Counting Log Activity
Did you know that Group-Object can analyze text-based log files for you? Here's sample code that tells you how many log entries on a given day a...
Shrinking Paths
Many file-related .NET Framework methods fail when the overall path length exceeds a certain length. Use low-level methods to convert lengthy paths...
Output to Console AND Variable
To assign results to a variable and at the same time view these results in your console, place the assignment operation into parenthesis: ($result =...
Converting to Signed Using Casting
In a previous tip, you learned how to use the Bitconverter type to convert hexadecimals to signed integers. Here is another way that uses type...
Chapter 20. Loading .NET Libraries and Compiling Code
Since PowerShell is layered on the .NET Framework, you already know from Chapter 6 how you can use .NET code in PowerShell to make up for missing...
Converting to Signed
If you convert a hex number to a decimal, the result may not be what you want: PS> 0xFFFF 65535 PowerShell converts it to an unsigned number...
Getting Timezones
Here's a low level call that returns all time zones: PS> [System.TimeZoneInfo]::GetSystemTimeZones() Id : Dateline Standard Time DisplayName...