When you open a MsgBox dialog from PowerShell, the dialog window may sometimes not be visible and instead appears behind the PowerShell or ISE...
database-tools
Calculate Broadcast Address
If you know the IP address and subnet mask, you can take these and calculate the broadcast address. Here's a function does it for you. Simply...
Convert IP address to decimal value (and back)
Sometimes you may want to convert an IP address to its decimal value, for example, because you want to use binary operators to set bits. Here are...
Running Portions of Code in 32-bit or 64-bit
To execute code in 32-bit from within a 64-bit environment (or vice versa), you can create appropriate aliases: In a 32-bit PowerShell, you create:...
Prompt for Credentials without a Dialog Box
Whenever a PowerShell script asks for credentials, PowerShell pops up a dialog box. You can view this by running this command: Get-Credential...
Converting Binary Data to IP Address (and vice versa)
In a previous tip we showed how you can display an IPv4 address as a binary. Here's an even faster (and more cryptic) way: $ipV4 =...
Finding User Group Memberships
If you run a large Active Directory, you should use specific Active Directory cmdlets or management functions. However, if you just want to know the...
Finding User Account with WMI
WMI represents all kinds of physical and logical entities on your machine. It also has classes that represent user accounts which include both local...
Displaying IPv4 address as Binary
Sometimes it may be useful to display an IPv4 address bit by bit, for example, to compare it with a subnet mask. Here's another example of just...
Shortening Parameter Arguments in PowerShell 3.0
In PowerShell 3.0, when a parameter expects a fixed list of values, you do not need to write the complete argument. It is OK to write just as much...
Resolving URLs
Sometimes you may stumble across URLs like this one: http://go.microsoft.com/fwlink/?LinkID=13517 As it turns out, these are just...
Validating Active Directory User Account and Password
Ever wanted to check whether a given user account and password was correct? Here is a little function that can help you: function Test-ADCredential...
Working With TimeSpan Objects
TimeSpan objects represent a given amount of time. They are incredibly useful when you calculate with dates or times because they can represent the...
Converting Low-Level Error Numbers into Help Messages
Sometimes, native commands such as net.exe return cryptic error numbers instead of full error messages. Traditionally, you could use the following...
Identifying 32-bit Executables
Thanks to Shay Levy from http://powershellmagazine.com for showing how to do this: here's a small function that returns the architecture an...
Creating String Arrays without Quotes
Often, you may need a list of strings and want to store it in a variable. The common coding practice is like this: $MachineType =...
Discover New "Internet"-Cmdlets in PowerShell 3.0
With Invoke-WebRequest and Invoke-RestMethod, PowerShell 3.0 now has powerful support for downloading information from the Internet as well as...
Using Help Window as Text Dialog
Did you know that you can use the Help Window that comes with PowerShell 3.0 and display your own text information inside of it? What's even...
Using Default Parameter Values
If you find yourself submitting the same value for a cmdlet parameter over and over again, then PowerShell 3.0 lets you set a default value. Once...
Find Matching Brace (or Parenthesis)
One common headache are non-matching braces or parentheses in PowerShell scripts. So when you write a script, it is recommended to align matching...
Using Central ISE Snippet Repository
In a previous tip we illustrated that ISE code snippets (press CTRL+J to view them) are plain ps1xml-files that you can manage in File Explorer. By...
Sharing and Exchanging ISE Code Snippets
By default, the PowerShell 3.0 ISE editor loads code snippets automatically, and you can then select and insert any of these by pressing CTRL+J....
Hiding Default ISE Snippets
The PowerShell 3.0 ISE editor ships with a number of default code snippets that you can see (and insert) by pressing CTRL+J. Once you start to...
Removing ISE Snippets
In a previous tip, we showed how you can use New-IseSnippet to add new code snippets to the ISE editor in PowerShell 3.0. These custom snippets stay...