Previously we illustrated how you can use a simple RegEx-based approach to find illegal characters in strings. We encourage you to expand this...
ps1
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...
Finding Public IP Address
Would you like to know what your public IP address is that you are currently using while being connected to the Internet? It’s a one-liner:...
Finding Location of IP Address
Most IP addresses can be located using web services. Here is a very simple function that takes an IP address and returns information about its...
Finding IP Address Assigned by DHCP
Beginning with Windows 8 and Server 2012, operating systems ship with extensive PowerShell modules to manage server and client. They provide cmdlets...
Enum Week: Enums in PowerShell 5
Requires PowerShell 5 or better This week we are looking at enumerations: what they are, and how you can benefit from them. Beginning in PowerShell...
Enum Week: Suppressing Cmdlet Errors – Fast
This week we are looking at enumerations: what they are, and how you can benefit from them. In the previous tips, we looked at enumerations, and...
Enum Week: Understanding Enumeration Values
This week we are looking at enumerations: what they are, and how you can benefit from them. In the previous tips, we explored how enumerations work....
Enum Week: Listing Enumeration Values
This week we are looking at enumerations: what they are, and how you can benefit from them. In the previous tip we explained how PowerShell converts...
Enum Week: Auto-Conversion for Enums
This week we are looking at enumerations: what they are, and how you can benefit from them. When a cmdlet or method requires an enumeration value,...
Working with UTC Times
When working across language boundaries, you might want to use a way to “normalize” date and time, for example for logging. Instead of...