Running $PSScriptRoot in Selected Code

Running $PSScriptRoot in Selected Code

One of the big pitfalls in PowerShell code is the automatic variable $PSScriptRoot which always holds the path to the folder the current script is located. This however requires that (a) the current script is in fact already saved to file, and (b) you are executing...

Running $PSScriptRoot in Selected Code

Pasting Multiple Lines in PowerShell

Unexpected Behavior When Pasting Multiple Lines of PowerShell Code When you copy multiple lines of PowerShell code and paste them into a shell window, the result often is not what you expect. PowerShell starts executing the first line and won’t execute the pasted code...

Running $PSScriptRoot in Selected Code

Cleaning Up PowerShell Modules (Part 2)

In part 1 we looked at removing PowerShell modules that were originally installed via “Install-Module”. You can as well remove PowerShell modules manually if you no longer need them. After all, they are just folders. PowerShell Modules Here’s code that lists all...

Running $PSScriptRoot in Selected Code

Cleaning Up PowerShell Modules (Part 1)

There are plenty of scripts available that promise to read the original Windows 10 product key from the registry by converting a series of binary values. In the first part of this mini-series, we’ll check out where PowerShell keeps its modules, and what you can do to...

Running $PSScriptRoot in Selected Code

Quickly Finding Outdated PowerShell Modules

In the most simplistic case, you can check all your installed modules for updates with just a one-liner (remove -WhatIf to actually perform the update): PS C:\> Get-InstalledModule | Update-Module -WhatIf Get-InstalledModule lists all modules that were installed in...

Running $PSScriptRoot in Selected Code

Analyze blocking for SQL Server

Blocking is a normal activity that occurs in SQL Server and it does that to control data integrity and make sure only one resource can change a set of data at one time. The problem with blocking is if SQL Server blocked a session for a long period, this can cause...

Running $PSScriptRoot in Selected Code

Using Efficient Lists in PowerShell

By default, PowerShell uses simple “object arrays” when you define lists, when commands return more than one result, or when you otherwise need to store more than one thing in a variable. Default object arrays are OK but they cannot grow once you created them. When...

Running $PSScriptRoot in Selected Code

Out-GridView with Custom Columns

Out-GridView can be a universal dialog when you use the -OutputMode or -PassThru parameters. When you do, a grid view window displays additional buttons in its lower right corner so you can choose items and pass them on to additional cmdlets. This line could help...

Running $PSScriptRoot in Selected Code

Converting Ticks to DateTime

Occasionally, date and time information are stored as “Ticks” in the format of a so-called “FileTime”. Ticks are 100-nanosecond units since 01/01/1601. Active Directory internally uses this format, yet you can also find it elsewhere. Reading Windows Installation Time...

Top 5 Benefits of Universal Database GUI

Top 5 Benefits of Universal Database GUI

Universal database graphical user interfaces (GUIs) are among the most productive tools available to database administrators (DBAs) and developers. A well-crafted universal database GUI can greatly assist team members to maintain and implement new features to their...

Running $PSScriptRoot in Selected Code

Unlock Additional PowerShell Modules in Windows 10

PowerShell Modules in Windows 10 for Server Management Windows 10 comes with a number of PowerShell modules that you can use to control Server functionality - like WSUS Update Management which is only one example of many. In earlier Windows 10 builds, these PowerShell...

Running $PSScriptRoot in Selected Code

What Is Non-Uniform Memory Access (NUMA)?

Bare metal to cloud hosted virtual machines Non-Uniform Memory Access (NUMA) is a four-letter word in every sense, well beyond simply the number of characters in the acronym to many data professionals, particularly those in an operational database administrator (DBA)...

Running $PSScriptRoot in Selected Code

Using BITS to Download Files (Part 1)

What Is BITS (Background Intelligent Transfer System)? BITS (Background Intelligent Transfer System) is the technique used by Windows to download huge files such as operating system updates. You can use the same system, too, to download large files. As an extra...

Running $PSScriptRoot in Selected Code

Repairing Install-Module (PowerShellGet)

With Install-Module, you can easily download and install additional PowerShell modules from the PowerShell Gallery (www.powershellgallery.com). However, on Windows systems this command may be broken. Many Windows systems still ship with the outdated version 1.x, and...

Identifying Performance Problems Part 1

Identifying Performance Problems Part 1

Every server, database, storage appliance and network encounter some sort of performance issues. It is a major part of our job as database administrators to properly monitor and fix those performance issues whether it is in your traditional on premises environment or...

1 3 4 5 6 7 16