PowerShell v3 Beta is available for quite some time now, so every now and then we start tossing in some PowerShell v3 tips. We'll clearly mark...
Powershell
Categories
- Free tools
- SQL Admin Toolset
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- SQL Doctor
- SQL Enterprise Job Manager
- SQL Inventory Manager
- SQL Query Tuner for SQL Server
- SQL Safe Backup
- SQL Secure
- SQL Workload Analysis for SQL Server
- Uptime Infrastructure Monitor Formerly Uptime
Hiding Drive Letters
Sometimes you may want to hide drive letters in Windows Explorer from users. There's a Registry key that can do this for you. It takes a bit...
Converting Letters to Numbers and Bit Masks
Sometimes, you may need to turn characters such as drive letters into numbers or even bit masks. With a little bit of math, this is easily doable....
Checking Size of Downloads-Folder
Whenever you download something with IE, by default the files get stored in your personal download folder. Often, over time a lot of garbage can...
Copying Files in the Background
In a previous tip we showed how you can use the BITS service to copy files. The main advantage of BITS is that it can copy things silently in the...
Using Splatting for Better Formatting
Supplying parameters to a cmdet often results in very long lines like this one: Get-ChildItem -Path $env:windir -Filter *.ps1 -Recurse -ErrorAction...
Copying Large Files with BITS
You can use Copy-Item or the console applications xcopy and robocopy to copy large files. But did you know that you can also use the BITS service to...
Matching "Stars"
Asterisk serve as wildcards, so how would you check for the presence of an asterisk? It's much harder than you might think: PS>...
Extract Paths from Strings Like Environment Variables
If you'd like to add a path to the %PATH% environment variable, that's easy: PS> $env:path += '
Clearing WinEvent Logs
With Get-WinEvent you can access the various Windows log files such as this one: PS> Get-WinEvent Microsoft-Windows-WinRM/Operational There is no...
Adding Clock to PowerShell Console
Maybe you'd like to include dynamic information such as the current time into the title bar of your PowerShell console. You could update the...
Integrating WhoAmI Into PowerShell
There is a cool little tool called whoami.exe which is part of Windows ever since Windows Vista. Since it can provide results not just in plain text...
Getting Group Memberships
If you'd like to know in which groups you are member, here's a simple piece of code that returns the list of groups you belong to: PS>...
Who am I?
If you'd like to know your current user account, of course you can query environment variables like this: PS> $env:userdomain PS>...
Optimizing PowerShell Performance
PowerShell is loading .NET assemblies. These assemblies can be precompiled using the tool ngen.exe which improves loading times (because the DLLs no...
Get Localized Month Names
To get a list of month names, you could use this line: PS>...
Creating Symmetric Array
By default, PowerShell uses jagged arrays. To create conventional symmetric arrays, here's how: PS> $array = New-Object 'Int32[,]'...
Finding Domain Controllers
If your computer is logged on to an Active Directory, here is some code to get to your domain controllers. Note that this will raise errors if you...
Executing Commands in Groups
In traditional batch files, you can use "&&" to execute a second command only if the first one worked. In PowerShell, the same can...
Listing All WMI Namespaces
WMI is organized into namespaces which work similar to subfolders. Here's a line that lists all namespaces you got: PS> Get-WmiObject -Query...
Formatting XML Files
Here's a cool little XML formatting tool. It takes the path to any XML file and allows you to specify an indent. Then, it saves the file as new...
Get .NET Runtime Directory
Ok, this is more for the developers. To find out where your .NET Runtime folder is, try this line: PS> $path =...
Communicating Between Multiple PowerShells via UDP
Assume you want to send some information to another PowerShell session, or you'd like to have one session wait until another is ready. Here are...
Custom Formatting DateTimes
In a previous tip we published the list of placeholders to define datetime patterns. You can use the very same placeholders to define your own...
Parsing Custom DateTime Formats (Part 2)
In a previous tip we illustrated how you can use ParseExact() to parse custom datetime formats. This only works though if the date and time...
Parsing Custom DateTime Formats
Sometimes, date and time information may not conform to standards, and still you'd like to interpret that information correctly as date and...
Parsing Date and Time
Parsing a date and/or time information is tricky because formatting depends on the regional settings. This is why PowerShell can convert date and...
Comparing Services in PowerShell
Compare-Object is one of the most widely ignored most powerful cmdlet around. It can compare results and figure out differences. For example, if...
Map Network Drive
Sure you can use the command net use to map a network drive. But this would not check for existing mapped drives. Here's a small function that...
Getting Windows Product Key
Ever wanted to read out the Windows license key? In the Windows Registry, this key is present, but it is stored as a digital ID. To convert it back...