Powershell

Turning AD User into a Hash Table

Sometimes it could be useful to load all attributes from a given AD user into a hash table. This way, you could edit them, and then use Set-ADUser...

Exporting ActiveDirectory Module

To manage users and computers in your Active Directory from PowerShell, you need the ActiveDirectory module which comes as part of the free RSAT...

Working with LDAP and Dates

LDAP filters are a fast and powerful way of retrieving information from Active Directory. However, LDAP filters use a very low-level date and time...

Show or Hide Windows

PowerShell can call internal Windows API functions, and in this example, we’d like to show how you can change the show state of an application...

Modern Replacement for systeminfo.exe

For ages, systeminfo.exe returned all profiling information for a computer, and could made object-oriented in Powershell – somewhat: PS...

Finding AD User by SAMAccountName

PowerShell 5 The free Microsoft RSAT tools come with a full-blown ActiveDirectory module, but sometimes simple AD tasks can be mastered with just a...

Cleaning Week: Deleting CBS Log File

Windows maintains a log file named cbs.log in $env:windir\logs\cbs. It logs various pieces of information related to the Windows trusted installer,...

Adding New Nodes to an XML Document

If you need to add new items to an XML document that already contains such items, the easiest way is to search for an existing item, then clone it....

Bringing Window in the Foreground

PowerShell can use Add-Type to access internal Windows API functions. This way, it is easy to bring any process window into the foreground. Here is...

Enabling PowerShell Remoting with NTLM

By default, PowerShell remoting uses Kerberos authentication and works only in domain environments, and only when you specify computer names, not IP...

Test-Connection with Timeout

The Test-Connection cmdlet implements a simple ping to check whether a system responds to an ICMP request. Unfortunately, you cannot specify a...

Use Get-CimInstance with DCOM

PowerShell 3.0 added an alternative to Get-WmiObject: Get-CimInstance seems to work very similar and can retrieve information from the internal WMI...

Waiting for Process Launch

PowerShell has a built-in support to wait until a process or many processes end: simply use Wait-Process. There is no support to do the opposite:...

Try CTRL+SPACE!

In the PowerShell ISE, there are two key shortcuts that can help you. Pressing TAB works just like in the console, and each time you press TAB, you...

Using Symbols in Console Output

Did you know that console output can contain special icons like checkmarks? All you need to do is set the console to a TrueType font like...

Removing Whitespace (and Line Breaks)

You may know that each string object has a method called Trim() that trims away whitespace both from the beginning and end of a string: $text =...