PowerShell “records” all your interactive command input to its command history, and Get-History shows them. If you played around with...
Powershell
Getting Latest PowerShell Gallery Module Version
On www.powershellgallery.com, Microsoft hosts a public script and module repository where you can exchange PowerShell code with others (see more on...
Testing Files and Folders (separately)
Test-Path is highly useful to test whether a file or folder exists, and it can be used with any of the PowerShell drives, so it can also test...
Getting Help for Cmdlet Parameters
There seems to be a bug in PowerShell 5.0 that limits the usefulness of the built-in help window. Whenever you run Get-Help with -ShowWindow, the...
Updating PowerShell Help with One-Liner
To get the most out of PowerShell, you should at least update PowerShell help once. This downloads and installs the base set of help files that show...
Getting IntelliSense for Cmdlet (PowerShell ISE)
If you’re reviewing some PowerShell code loaded into the PowerShell ISE, it’s really simple to get additional information. Click the...
Downloading Pictures from Website
There are awesome websites out there, and one is www.metabene.de (at least for German visitors)-- on 33 pages, the artist presents his drawings for...
Simple Strategy for Cmdlet Error Reporting
In PowerShell, you can create complex error handlers but sometimes you might just want to know what went wrong so you can log it. No overkill...
Check File Names for Illegal Characters
File names are quite sensitive and may not contain a number of reserved characters. To validate file names and make sure they are legal, here is a...
Finding Illegal Characters in Paths (File System)
Previously we illustrated how you can use a simple RegEx-based approach to find illegal characters in strings. We encourage you to expand this...
Finding Multiple Illegal Characters
Previously, we illustrated how to use the -match operator to find illegal characters in a text. The -match operator finds only the first match,...
Checking Email Addresses (and Other Text) for Illegal Chars
Here is a quick approach to do sanity checks and validate data. Let’s assume you’d like to find out whether an email address contains...
PowerShell Remoting and HTTP 403 Error
If you use PowerShell remoting and get “HTTP 403” errors, one of the more obscure reasons for this is a proxy that interferes with your...
Enabling CredSSP Trust from One Side
As previously shown, CredSSP can be used to remote code without double hop issues. To use CredSSP authentication, though, you need to make...
Solving Double Hop Remoting with CredSSP
In a previous tip we illustrated the double hop problem that can occur in remoting when your remote code tries to authenticate against a third...
Understanding the Double-Hop Problem in Remoting
Whenever you execute PowerShell code remotely with Invoke-Command, your credentials are locked to the machine you initially contacted. PowerShell...
Finding Hidden Autostart Programs
Ever wondered why some programs launch whenever you log into Windows? Here’s a one liner listing autostarts that affect your login: #requires...
Getting List of Current Group Memberships
While you can contact the Active Directory to retrieve a list of group memberships for a user, a much easier way gets that information directly from...
Translating SID to Username
Ever wanted to translate a security identifier (SID) to the real name? Here is a function helping you: #requires -Version 3.0 function...
Get GeoLocation of Computer
Here is yet another free source of geolocation information, exposing your current public IP and location information: #requires -Version 3.0...
Finding Operating System Architecture Information
Here is a one-liner that retrieves information about your operating system: Get-WmiObject -Class Win32_OperatingSystem | Select-Object -Property...
Finding Operating System Versions in Active Directory
If you have installed the free Microsoft RSAT tools with the “ActiveDirectory” PowerShell module, here is a quick way to get a list of...
Finding First and Last Day in Month
Did you ever need the first and last day in a given month? Here is a simple approach: # specify the date you want to examine # default is today...
Geolocating Your IP on a Map
As you have seen in previous tips, the Internet knows your IP address, and also where you are located. You can get the latitude and longitude of...