Here is a rather unusual use case for function parameters: a user can pass an output command: function Get-ProcessList { param ( [string]...
Powershell
Categories
- Free tools
- SQL Admin Toolset
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- SQL Doctor
- SQL Enterprise Job Manager
- SQL Inventory Manager
- SQL Query Tuner for SQL Server
- SQL Safe Backup
- SQL Secure
- SQL Workload Analysis for SQL Server
- Uptime Infrastructure Monitor Formerly Uptime
Dealing with File Encoding and BOM
When you write text content to a file, PowerShell cmdlets let you specify the encoding. Encoding determines how characters are stored, and when...
Finding Nested Active Directory Memberships (Part 3)
In the previous tip we illustrated how you can find out the direct and indirect group memberships for a user. If you’d like to know the...
Finding Nested Active Directory Memberships (Part 2)
In the previous tip we illustrated how you can use the cmdlets in the ActiveDirectory module to find all direct and indirect memberships for an...
Finding Nested Active Directory Memberships (Part 1)
The ActiveDirectory module (part of the free RSAT tools) provides a number of AD cmdlets. One of these can dump all direct group memberships, for...
Progress Bar Timer
Here is a simple example using the PowerShell progress bar. The code displays a progress bar counting down a break. Simply adjust the number of...
Automatic Document & Report Generation (Part 5)
Iain Brighton has created a free PowerShell module called „PScribo“ that can be used to easily create documents and reports in text, html, or Word...
Automatic Document & Report Generation (Part 4)
Iain Brighton has created a free PowerShell module called „PScribo“ that can be used to easily create documents and reports in text, html, or Word...
Automatic Document & Report Generation (Part 3)
Iain Brighton has created a free PowerShell module called „PScribo“ that can be used to easily create documents and reports in text, html, or Word...
Automatic Document & Report Generation (Part 2)
Iain Brighton has created a free PowerShell module called „PScribo“ that can be used to easily create documents and reports in text, html, or Word...
Automatic Document & Report Generation (Part 1)
Iain Brighton has created a free PowerShell module called „PScribo“ that can be used to easily create documents and reports in text, html, or Word...
Exchanging Variable Values
Here’s a quick tip how to switch variable content in one line: $a = 1 $b = 2 # switch variable content $a, $b = $b, $a $a $b ReTweet this...
Returning Rich Objects from Functions (Part 2)
Whenever a function returns objects with more than four properties, PowerShell formats the output as list, else as table. Before you learn a new...
Returning Rich Objects from Functions (Part 1)
If a PowerShell function needs to return more than one information kind, always make sure you wrap the pieces of information inside a rich object....
Using persisting variables inside functions
By default, when a PowerShell function exits, it “forgets” all internal variables. However, there is a workaround that creates...
Using Default Parameters
If you find yourself always using the same parameter values over again, try using PowerShell default parameters. Here is how: # hash table # Key = #...
Speed Difference: Reading Large Log Files
When it comes to reading large log files and, for example, extracting error messages, PowerShell can either use the low memory pipeline, or the high...
Finding Executable for File
Most things can be handled by built-in PowerShell commands, but if that’s not enough, you can always resort to the internal Windows API. For...
Understanding Script Block Logging (Part 7)
This is part 7 of our mini-series covering PowerShell script block logging. We now just need some cleanup tool that can clear the script block...
Understanding Script Block Logging (Part 6)
This is part 6 of our mini-series covering PowerShell script block logging, and it’s time to address a final thing: when you execute very...
Understanding Script Block Logging (Part 5)
This is part 5 of our mini-series covering PowerShell script block logging. We are almost done, and what’s missing is a better way to read...
Understanding Script Block Logging (Part 4)
This is part 4 of our mini-series covering PowerShell script block logging. By now, you know how to read logged PowerShell code, and how to turn on...
Understanding Script Block Logging (Part 3)
This is part 3 of our mini-series covering PowerShell script block logging. By default, PowerShell logs only code that is considered security...
Understanding Script Block Logging (Part 2)
[PSCustomObject _i="0" _address="0" theme_builder_area="post_content" /][2 _i="1" _address="1" theme_builder_area="post_content" /][0 _i="2"...
Understanding Script Block Logging (Part 1)
Beginning with PowerShell 5, the PowerShell engine starts to log executed commands and scripts. By default, only commands considered potentially...
Adding Leading Zeroes
If you need numbers with leading zeroes, for example for server names, here are two approaches. First, you can turn the number into a string, then...
Displaying Message Box
If you’d like to show a default MessageBox with some buttons for the user to click, try this function: function Show-MessageBox {...
Displaying Input Box
If you’d like to open a quick and dirty input box to prompt a user for some data, you could access Microsoft Visual Basic and...
Reading Text Files Fast
There are plenty of ways how PowerShell can read in text files, and they can differ considerably in time. Check for yourself. The examples below...
Create Universal Time from Local Time in ISO Format
If you’re working across countries and time zones, you may want to use universal time instead of local time. And to ensure that the time...