In the PowerShell ISE 4.0 command pane, when you hold CTRL, you can then use ArrowUp to move out of the command line into the results area. ReTweet...
Powershell
Finding Active Directory Users with Missing Mail Address
LDAP queries are extremely powerful and can help find accounts that are missing information. This code would return all Active Directory users that...
Getting Excuses Automatically
Tired of inventing lame excuses yourself? Then here's a script that gets you a new excuse any time you call Get-Excuse! All you need is Internet...
Exporting and Importing PowerShell History
PowerShell keeps a list of all commands you enter, but once you close PowerShell, the list is lost. Here is a simple one-liner that saves the...
Capitalizing Words
To correctly capitalize words (making sure the first character is capitalized), you can either use regular expressions or a little system function....
Finding Default Outlook Profile
PowerShell can access COM objects like Outlook Application. These two simple lines return the current Outlook profile: $outlookApplication =...
Dynamic Methods in PowerShell 4
Beginning with PowerShell 4.0, method names may come from variables. Here's a simple example: $method = 'ToUpper'...
Dynamic Parameters in PowerShell 4.0
In PowerShell, you can use variables in place of properties. This sample script defines the four property names that return profile paths, then...
Replacing Specific Characters in a Text
If you just need to replace characters anywhere in a text, you are easy off. This would capitalize every "l" in a text: "Hello...
Weird Text Formatting (and what to do about it)
Check out this code and try to find the problem: $desc = Get-Process -Id $pid | Select-Object -Property Description "PowerShell process...
Finding Services in PowerShell
Get-Service lists all services on a computer, but the information returned is very sparse. You cannot easily see what a service does, whether it is...
Getting More Than 1000 Active Directory Results
By default, Active Directory returns only the first 1000 search results when you use an ADSISearcher. This is a security mechanism designed to...
Hiding Parameters from IntelliSense
Beginning with PowerShell 4.0, a script author can decide to hide function parameters from IntelliSense. This way, less frequently used parameters...
Finding Active Directory User Accounts Fast
The more specific your LDAP query is the faster and less resource intense the query is, and the more precise are the results as well. For example,...
Finding Active Directory Accounts by SID
If you know the SID and would like to find the corresponding Active Directory account, then LDAP queries won't work well. For them to work, you...
Searching in Different Domains
When you use the ADSISearcher type accelerator to find Active Directory accounts, it defaults to the current domain you are logged on to. If you...
Getting Domain from DN
A "DN" (Distinguished Name) is the path to an Active Directory object and could look similar to this:...
Converting Binary SID to String SID
Active Directory accounts contain the SID in binary form. To convert the byte array into a string representation, use a .NET function like this: #...
Finding Current Script Folder
Beginning in PowerShell 3.0, there is a very easy way of determining the folder a script is located in: $PSScriptRoot. This variable always holds...
Getting Active Directory Account Information
In a previous script you have discovered how easy it is to find Active Directory accounts with just some simple PowerShell code. The result is a...
Finding AD User Accounts
There are modules and cmdlets to deal with Active Directory tasks, but sometimes it is easier and faster to simply use some .NET code instead. If...
Resetting PowerShell Host in ISE
Imagine you have worked long hours on a script in the ISE editor. While you worked on it, you probably have defined variables, created functions,...
Finding Cmdlets
Get-Command can be used to find cmdlets, but in PowerShell 3.0 it will often return many more cmdlets than expected. Due to module auto-loading,...
Pasting PowerShell Code from ISE Editor
The PowerShell ISE editor is great for copying and pasting code, for example to Microsoft Word and other text processors. Since ISE formats the...