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...
powertips
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 {...