Removing BOM from Unicode Text Files Using PowerShell BOM (Byte Order Mask) is a characteristic byte sequence used in some Unicode encoded text...
posts-powershell
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
Get Text File Encoding
Ensuring Correct Text File Encoding in PowerShell Text files can be stored using different encodings, and to correctly reading them, you must...
SID of Current User
psconf.eu – PowerShell Conference EU 2019 – June 4-7, Hannover Germany – visit www.psconf.eu There aren’t too many trainings around for experienced PowerShell scripters where…
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)
Using Microsoft Print to PDF from PowerShell Windows 10 and Windows Server 2016 finally come with a built-in PDF printer called “Microsoft Print to...
Using FileSystemWatcher Correctly (Part 2)
Understanding the FileSystemWatcher and Its Limitations In the previous tip we introduced the FileSystemWatcher and illustrated how it can miss...
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...
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....
Detecting WinPE
Running PowerShell in WinPE Environments PowerShell can run inside WinPE environments. If you’d like to detect whether your PowerShell script runs...
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 “dir” to point you to the...
Progress Bar Timer
Use the PowerShell progress Bar Here is a simple example using the PowerShell progress bar. The code displays a progress bar counting down a break....
Understanding Script Block Logging (Part 1)
Beginning with PowerShell 5, the PowerShell engine starts to log executed commands and scripts. By default, only commands considered potentially...
Reading Event Logs Smart (Part 1)
When you query an event log with PowerShell, by default you get back a text message with the logged information. For example, if you’d like to know...
Turning Display Off Immediately
If you are about to launch a lengthy automation script, why not turn off the display right away instead of waiting for the screen saver timeout to...
Purging Kerberos Tickets for All Accounts
In the previous tip we covered klist.exe and how it can be used to purge all Kerberos tickets for the current user so that new permissions will take...
Purging Kerberos Tickets for the Current User
No need to reboot a system just to apply new permission settings. Instead, purge your Kerberos tickets so that you will get a new ticket based on...
Using Chocolatey with PowerShell
Chocolatey is a free package manager for Windows that can be used to download and install software. Installing Chocolatey via PowerShell Before you...
Positioning the PowerShell Console Cursor
Enabling VT Escape Sequences in PowerShell 5.1 Starting in PowerShell 5.1, the PowerShell console supports VT escape sequences that can be used to...
Sort IPv4 and IPv6 Addresses Correctly
When you try and sort IPv4 addresses via Sort-Object, this fails: PS> '10.1.2.3', '2.3.4.5', '1.2.3.4' | Sort-Object 1.2.3.4 10.1.2.3 2.3.4.5...
Sort IPv4 Addresses Correctly
Reviewing the Test-OnlineFast Function In the previous tip we published a super-fast function called Test-OnlineFast, and this function was able to...
Final Super-Fast Ping Command
Revisiting the Test-Online Fast Function In the previous tip series, we developed a new function called Test-OnlineFast that can ping multiple...
Finding Registered Event Log Source Names
Understanding Event Log Source Names When you write events to an event log using Write-EventLog, you must specify a valid source name. However,...
Select-Object and -ExcludeProperty
Here is a line of code that often puzzles PowerShell users: Get-Service | Select-Object -ExcludeProperty Name Understanding the -ExcludeProperty...
Converting PowerShell to Batch
Here is a fun PowerShell function called Convert-PowerShellToBatch. Provide it with the path to a PowerShell script, or pipe in the results from...
Converting User Name to SID
If you’d need to find out the SID for a user name, here is a useful chunk of code that does the job: $domain =…
Displaying Data in a Grid View Window Vertically
Out-GridView always produces a table with one object per line: Get-Process -Id $pid | Out-GridView Occasionally, it would be more helpful to display the object…
Finding All Domain Controllers (no module required)
Reviewing the ActiveDirectory Module Approach In the previous tip we explained how you can use the ActiveDirectory module and its cmdlets to find...