posts-powershell

Getting Cached Credentials

Managing Cached Credentials with PSCredentialManager In the previous tip we talked about a public module called PSCredentialManager that helps you...

Parsing Distinguished Names

Using Split() for Parsing Distinguished Names Distinguished names are strings, and strings contain powerful ways of parsing data. The most powerful...

Creating Random MAC Addresses

Randomly Generated MAC addresses If you just need a bunch of randomly generated MAC addresses, and you don’t care much about whether these addresses...

Converting Binary String to Integer

Convert a binary text string into integer Here is how you convert a binary text string into the corresponding integer value: $binary = "110110110"...

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 LDAP filters are a fast and powerful way of retrieving information from Active Directory. However, LDAP filters use a very low-level...

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

Retrieving System Profiling Information with systeminfo.exe For ages, systeminfo.exe returned all profiling information for a computer, and could...

PowerShell Remoting and HTTP 403 Error

Resolving "HTTP 403" Errors in PowerShell Remoting If you use PowerShell remoting and get “HTTP 403” errors, one of the more obscure reasons for...

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...

Changing Excel Cells from PowerShell

Modifying a Specific Cell in an Excel Spreadsheet Using PowerShell If you need to change the content of a specific cell in an Excel spreadsheet,...

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,...

One-Liner Random Password Generator

Generating Temporary Passwords the Easy Way Check out this simple way of creating temporary passwords: You can easily vary the password length: change the number…

Adding New Nodes to an XML Document

Adding New Items to an XML Document Efficiently If you need to add new items to an XML document that already contains such items, the easiest way is...

Bringing Window in the Foreground

Bringing a Process Window to the Foreground with PowerShell PowerShell can use Add-Type to access internal Windows API functions. This way, it 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

Using Get-CimInstance as an Alternative to Get-WmiObject PowerShell 3.0 added an alternative to Get-WmiObject: Get-CimInstance seems to work very...

Waiting for Process Launch

PowerShell has a built-in support to wait until a process or many processes end: simply use Wait-Process. Understanding Data Marts and Dimensional...

Try CTRL+SPACE!

Useful Keyboard Shortcuts in PowerShell ISE In the PowerShell ISE, there are two key shortcuts that can help you. Pressing TAB works just like in...