Articles Tagged “Script”
14 articles tagged “Script”, newest first.
-
Where to Look When a PowerShell Script Is Slow — Arrays, Pipelines and Matching
The classic causes of slow PowerShell scripts, laid out. Why += on an array is O(n^2), the difference between the pipeline and foreach, turning matching into...
-
Stop Using Write-Host — PowerShell Output Streams and Log Design
How to choose between PowerShell's six output streams, the problems with Write-Host and where it genuinely belongs, why function return values get polluted, ...
-
Parallel Processing in PowerShell — Choosing Between ForEach-Object -Parallel and Jobs
A practical rundown of the differences between ForEach-Object -Parallel, Start-ThreadJob and Start-Job and when to use each, $using: and thread safety, how t...
-
Calling External EXEs Correctly from PowerShell — The Pitfalls of Argument Quoting, Exit Codes, and Mojibake
Call robocopy or an in-house EXE from PowerShell and the arguments break, the exit code is unavailable, and the output turns into mojibake. A practical rundo...
-
Should That Batch File Move to PowerShell? — Auditing cmd/bat Assets and Making the Migration Call
A decision table for working out whether the batch files still running your business should move to PowerShell: how cmd and VBScript differ in status, bat's ...
-
Calling COM and .NET from PowerShell — Widening What Your Scripts Can Reach
A practical guide to calling .NET classes from PowerShell, embedding C# and Win32 APIs with Add-Type, driving COM, cleaning up leftover Excel processes, why ...
-
Handling Credentials Safely in PowerShell — Banishing Plaintext Passwords from Your Scripts
A practical walkthrough of moving plaintext passwords out of PowerShell scripts and into safe storage: what SecureString really is and where it stops, how Ex...
-
Parameter Design and Modularization for PowerShell Scripts — From a Script That Works to a Script You Can Hand Over
A step-by-step procedure for raising a PowerShell script to a quality you can hand to someone else. Covers the param block and [CmdletBinding()], input valid...
-
Taking Inventory of a File Server with PowerShell — Capacity Analysis and Access Permission (ACL) Auditing
A practical procedure for taking inventory of a file server with PowerShell. Covers capacity analysis and recording access denials, listing old files and ext...
-
An Introduction to PowerShell Remoting (WinRM) — Managing Multiple Windows Machines at Once
An introduction to managing multiple Windows machines at once with PowerShell Remoting (WinRM). Covers how it works and ports 5985/5986, what Enable-PSRemoti...
-
The Differences Between Windows PowerShell 5.1 and PowerShell 7 — A Practical Guide to Migrating In-House Scripts
The relationship between Windows PowerShell 5.1 and PowerShell 7 (side-by-side coexistence and pwsh.exe), Microsoft's official position that 5.1 gets no new ...
-
Automating Excel and CSV Work with PowerShell — Practical Recipes for Aggregation, Reconciliation, and Report Output
Practical recipes for automating CSV aggregation, reconciliation, and Excel report output with PowerShell. Covers the default encodings of Import-Csv/Export-...
-
PowerShell Error Handling and Retry Design — From the try/catch Trap to Exit Codes and Retry Best Practices
A practical rundown of PowerShell error handling: the difference between terminating and non-terminating errors, the -ErrorAction Stop pattern for the try/ca...
-
PowerShell Execution Policy and Script Signing — A Practical Guide to Graduating From "Papering Over It With Bypass"
PowerShell's execution policy is "a safety feature, not a security boundary." This article covers the differences between policies like RemoteSigned, scope p...