Beginning with PowerShell 3.0, you can use New-PSDrive to map network drives. They will be visible in File Explorer as well. Here is some sample...
database-tools
Mapping Network Drives (Part 1)
PowerShell supports console commands, so if you need to map a network drive, often the most reliable way is to use good old net.exe like this:...
Executing with Timeout
Start-Process can start processes but does not support a timeout. If you wanted to kill a runaway process after a given timeout, you could use an...
Executing Selected Code as Admin
If you need to run selected parts of your script with Administrator privileges, you could temporarily launch a second PowerShell with Administrator...
Finding Drive Letters
Here is a simple function to find out the reserved drive letters: #requires -Version 3 function Get-DriveLetter { (Get-WmiObject -Class...
Quickly Setting Multiple Environment Variables
To quickly (and permanently) set a bunch of environment variables, here is a nice approach: $hashtable = @{ Name = 'Weltner' ID = 12 Ort =...
Quickly Finding Scripts
To quickly locate a PowerShell script anywhere in your MyDocuments folder, take a look at this Find-Script function: #requires -Version 3 function...
Monitoring your Amazon Aurora Databases using Monyog
We're excited to announce the general availability of Monyog for Amazon Aurora. Amazon Web Services' (AWS) latest offering, the Aurora...
Hiding Variable Content
When you override the ToString() method of an object you control how this object is displayed. The object content stays untouched, though: $a = 123...
Adding Additional Information to Objects
When you retrieve results, you may want to add additional properties to the results so later you know where they came from. Attaching additional...
Appending Extra Information to Primitive Data Types
Maybe you'd like to tag a variable and provide some extra information. In PowerShell, use Add-Member and attach NoteProperties or ScriptProperties...
Simple Replacement for INI Files
If you'd like to keep settings outside of your script and store them in a separate config file, then you can use all kinds of data formats for...
Remove Array Elements
Did you ever need to compare two arrays? Compare-Object might help. Check this out: $array1 = 1..100 $array2 = 2,4,80,98 Compare-Object...
Quickly Getting IP Addresses
You want to quickly get a list of IP addresses for your own computer or a network machine? Here is how: #requires -Version 3 $ComputerName =...
Shortening Text
Let's assume you want to chop off some text at the end of a string. This is the traditional approach using string operations: $text = "Some...
The Hidden Elephant in ‘Big Data’ Modeling – by Len Silverston
The Elephant “We must understand the data and therefore continue to develop data models, even in this 'Big Data' era." exclaimed the data warehouse...
Avoid Using Redirection
While you can still use the old redirection operator to write command output to a file, you should rather use PowerShell cmdlets instead. Here is...
Breaking Down Business Barriers with Enterprise Architecture – Slide Presentation
Below is the slide presentation from our recent webinar Breaking Down Business Barriers with Enterprise Architecture. See the companion webinar at:...
Encode PowerShell Commands
When you need to run code as a PowerShell command in a separate powershell.exe, it is not always safe to submit the code. Depending on from where...
Define Multiline Text
When you need to define multiline text, in PowerShell you typically use here-strings like this: $text = @" I am safe here I can even use...
Current Script Path
In PowerShell 1.0 and 2.0, you needed a lot of weird code to find out the current script location: # make sure the script is saved and NOT...
Discovering Dynamic Parameters
In a previous tip we showed how you find cmdlets that expose dynamic parameters. Let's explore what the dynamic parameters are. The function...
Finding Cmdlets with Dynamic Parameters
Some cmdlets expose dynamic parameters. They are valid only in certain contexts. Get-ChildItem, for example, exposes -File and -Directory only when...
Change ISE Zoom Level
The PowerShell ISE sports a zoom slider at its lower right edge, and you can control this slider with PowerShell code. So you could set defaults for...