In the previous tip we looked at the FileSystemWatcher object and how it can monitor folders for changes. To not miss any changes, however, an...
database-tools
Categories
- Free tools
- SQL Compliance Manager
- SQL Defrag Manager
- SQL Diagnostic Manager for MySQL
- SQL Diagnostic Manager for SQL Server
- SQL Diagnostic Manager Pro
- 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
Finding PowerShell Named Pipes
Each PowerShell host running PowerShell 5 or better opens a “named pipe” that you can detect. The code below identifies these named...
Using a Queue instead of a Recursion
Rather than calling functions recursively, you may at times want to use a Queue object that you can load with fresh tasks while you are unloading...
Locking the Screen with PowerShell
Here is a PowerShell function called Lock-Screen that can lock the screen and prohibit user interaction. There can be a custom message, and the...
The Impact of Cloud on DBA
The DBA is the information technology professional responsible for ensuring the ongoing operational functionality and efficiency of an...
Passing Arguments to Encoded Commands
Encoding PowerShell code is a great way to run PowerShell code outside the PowerShell environment, i.e. in batch files. Here is some sample code...
Deleting Registry Keys that can’t be Deleted
Deleting registry keys is typically trivial and can be done with Remove-Item. However, every once in a while, you may come across registry keys that...
Splitting Large Files in Smaller Parts (Part 1)
PowerShell can split large files in multiple smaller parts, for example to transfer them as email attachments. Today, we focus on splitting files....
Using Custom Prompts for Mandatory Parameters
When you define mandatory parameters in PowerShell, the user gets prompted for the value if it is missing. The prompt uses the parameter name only...
Calculating Most and Least Significant Byte
Numbers are stored internally as bytes. An Int32 value, for example, uses four bytes. Sometimes it is required to split up the number into its byte...
Create ASCII Art
It’s amazing how versatile PowerShell is: with just a couple of lines of code, you can turn any photo and image into a piece of ASCII art....
Verifying Local User Account Passwords
In the previous tip, we asked Active Directory to validate user account passwords. The same can be done with local accounts. Your PowerShell code...
Converting Text to Image
WPF (Windows Presentation Foundation)is not just a technique to create UIs. You can create any type of vector-based graphics composition and save it...
Removing Empty Array Elements (Part 1)
Occasionally you come across lists (arrays) with empty elements. What’s the best way of removing empty elements? Let’s first focus on a...
Removing BOM from the Unicode Files
BOM (Byte Order Mask) is a characteristic byte sequence used in some Unicode encoded text files. If you receive text files with BOM that need to be...
Get Text File Encoding
Text files can be stored using different encodings, and to correctly reading them, you must specify the encoding. That’s why most cmdlets...
SID of Current User
Here is a one-liner that returns the SID for the current user and can be used in logon scripts, for example:...
Finding Windows Universal Unique Identifier (UUID)
Every Windows installation has a unique UUID that you can use to distinguish machines. While computer names can change, the UUID won’t: PS>...
Formatting Date and Time (with Culture)
In the previous tip we illustrated how Get-Date can take a format string and convert DateTime values to strings. The string conversion always uses...
Sending PowerShell Results to PDF (Part 1)
Windows 10 and Windows Server 2016 finally come with a built-in PDF printer called “Microsoft Print to PDF” that you can use from...
Using FileSystemWatcher Correctly (Part 2)
In the previous tip we introduced the FileSystemWatcher and illustrated how it can miss filesystem changes when your handler code takes too long. To...
Using FileSystemWatcher Correctly (Part 1)
A FileSystemWatcher can monitor a file or folder for changes, so your PowerShell code can immediately be notified when new files are copied to a...
Using Solid Alternatives for $MyInvocation
Lines like $MyInvocation.MyCommand.Definition can be useful to determine the folder in which the current script is stored, i.e. to access other...
SQL Performance, Part 2: Query Analysis and Access Path Formulation
In part one of our overview of SQL performance we examined relational optimization and the things that impact it. In today’s blog post, we...
Data Architecture: The Foundation for Enterprise Architecture and Governance
"Data modeling is all about understanding the data within our organizations and then representing this data in a precise visual (the...
Translating VBScript to PowerShell
Most old VBS scripts can be easily translated to PowerShell. The key command in VBS is “CreateObject” which lets you access system libraries....
How to Find and Fix SQL Server Deadlocks
Introduction Locking is required for concurrent operations of relational databases to prevent data inconsistency and loss. However, locking impairs...
Detecting WinPE
PowerShell can run inside WinPE environments. If you’d like to detect whether your PowerShell script runs inside a WinPE environment, you can...
Extract Specific Files from ZIP Archive
Starting with PowerShell 5, cmdlets like Extract-Archive can extract the content of ZIP files to disk. However, you can always extract only the...
Running CMD commands in PowerShell
PowerShell by default does not support the native cmd.exe command such as „dir“. Instead, it uses historic aliases called...