database-tools

Adding Custom Attributes to AD Objects

If you’d like to add custom attributes to an AD object, simply use a hash table, and add the desired attribute names and their values. Then...

Get Command History as File

The built-in PowerShell ISE editor that ships with PowerShell 3.0 or better can be customized, and you can add your own menu items. When you run the...

Simple AD Group Management

Provided you have downloaded and installed Microsoft’s free RSAT tools, managing AD groups and group members is very simple. Here are some...

Using PowerShell Help

To access the full PowerShell help, you first need to download help information from the Internet. Simply launch a PowerShell console with full...

Setting AD Account Expiration Date

To safely use temporary AD accounts, for example for guests or consultants, always make sure to set an expiration date. Here is some sample code...

First Steps Automating AD

When you download the free RSAT tools from Microsoft, these include the ActiveDirectory module. It contains a rich set of cmdlets to manage Active...

Encrypting Text

There are many ways to encrypt text. Here is an approach that does not use an explicit “secret”. Instead, the secret is defined as your...

Moving Outdated Log Files to Archive

Occasionally, you may want to move files to an archive folder when they are older than a given number of days. Here is an example that illustrates...

Create “Task Kill” Application

With just one pipeline command, PowerShell can open a list of running applications. You can then select one or more in the list (hold CTRL to select...

Open Web Page

To quickly open a new web page in the Internet Explorer, you could define a new function called Show-WebPage like this: #requires -Version 2...

Getting Active Directory User Name

Here is a quick way to find the current user in your Active Directory and retrieve account information such as the display name:...

Listing All Variables in All Scripts

Ever wanted an inventory of variable names used in all open scripts in the PowerShell ISE? Here is some code that you can run to create such a list:...

Quick Loop

Requires PowerShell 4.0 There are plenty of looping constructs in PowerShell. Here is a rather unusual way introduced in PowerShell 4.0 to repeat...

Analyzing (All) Event Log Entries

You probably know Get-EventLog. This cmdlet can dump all entries from a given event log: Get-EventLog -LogName System However, Get-EventLog can only...

Refresh Newly Mounted Disks

If your script has just mounted a new drive, PowerShell may not immediately be able to access it (via Get-ChildItem, for example), because...

Load Cmdlets from PSSnapins

Most cmdlets these days are organized in modules. Modules were introduced in PowerShell 2.0. Their main advantage is copy&paste deployment (no...

1 91 92 93 94 95 159