Featured Blog
Empowering Law Firms: How SQL Server and Idera Tools Safeguard Legal Data
Preventing Direct Function Calls
If you must make sure that a function within your script is inaccessible from outside calls, you can use this trick. Save this code as a script...
Use Select-String For Fast Textfile Parsing
Select-String is an extremely useful cmdlet for parsing log files. You can use it to dump all lines in a text file that contain a certain keyword....
OSX Java 1.6.0_51 Update Fix posted to Apple-Java mailing list
Apple has posted a fix to the Apple-Java mailing list. Here is the post :...
Replace Escape
There are two ways for replacing text, and both have their advantages and pitfalls: Each string has a Replace() method which works very...
Changing Scheduled Tasks with PowerShell
PowerShell can read and also change any part of a scheduled task. Just make sure you have appropriate permissions and run PowerShell elevated....
PowerShell 3.0 Help Available on Non-US-Systems
PowerShell 3.0 does not ship with help files. Instead, they need to be downloaded separately using Update-Help. Unfortunately, PowerShell 3.0 help...
Latest Mac OS X Java Update to 1.6.0_51 Seems Broken
The update to 1.6.0_51 seems broken and causes ADS to no longer be functional. In diagnosing the problem, we have been able to add a small patch...
Examining Scheduled Tasks
There is a COM interface that you can use to select and dump any scheduled task definition. Just make sure you are running PowerShell with full...
Reversing Text Strings
Here's a simple trick to reverse a text string: $text = 'Hello World' $text = $Text.ToCharArray() [Array]::Reverse($text) -join $text...
Running Portions of Code Elevated
Let's assume your script may or may not need to do a privileged operation, for example write a value to a HKEY_LOCAL_MACHINE branch, depending...
Creating New Objects – Alternative
There are many ways in PowerShell to create new objects. One of the more advanced approaches uses a hash table to determine object properties and...
Counting Number of Files – Fast!
If you need to know the number of files in a folder, there are different approaches with different advantages and disadvantages. The first one is...
Don't See Alert Under My Portal My Alert
I have problem with the alert in my portal. One user don’t see anything in Myportal but it’s setup like all the other any idea? What...
Turning CSV-Files into "Databases"
Let's assume you have a CSV file with information that you need to frequently look up. For example, the CSV file may contain server names and...
Testing Event Log Names and Sources
Write-EventLog lets you write custom entries to event logs, and New-EventLog can add new event logs and event sources. Which raises the question:...
Writing Text Information Fast
If you want to write plain text information to a file, don't use Out-File. Instead, use Set-Content. It is much faster: $tempfile1 =...
Quickly Replace Words in Text File
In a previous tip we explained how you can convert a string array into one big string. That's a prerequisite for quickly searching and replacing...
Converting String Array in String
When you use Get-Content to read the content of a text file, you always get back a string array. So each line of your text file is kept separately....
Keeping MsgBox On-Top
When you open a MsgBox dialog from PowerShell, the dialog window may sometimes not be visible and instead appears behind the PowerShell or ISE...
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...