Tag: powershell
All the articles with the tag "powershell".
-
Write-Error vs error tracing
PowerShell Write-Error always reports line 1 instead of the actual error location, with no clean workaround found.
-
PowerShell $ErrorActionPreference = "Stop" vs error tracing
Why ErrorActionPreference Stop hides the true error line number and how trap { throw $Error[0] } fixes it.
-
PowerShell Start-Job WTF
Troubleshoots Start-Job scope issues with PSScriptRoot and shows how to invoke a script path asynchronously using ScriptBlock.Create.
-
PowerShell Start-Process WTF
Documents a known PowerShell bug where Start-Process -PassThru does not expose ExitCode, with a workaround using Process.Start.
-
PowerShell .NET property access swallows exceptions
Demonstrates that PowerShell silently returns null when a .NET property getter throws an exception, and how to avoid it.
-
Unicode literals in PowerShell
How to express Unicode character literals in PowerShell using char casts and ConvertFromUtf32, including surrogate pair handling.
-
PowerShell Registry Set-ItemProperty gotchas
Documents undocumented Type parameter behavior in Set-ItemProperty and how to correctly read and write typed registry values.
-
PowerShell 3 - Attempting to perform the InitializeDefaultDrives operation on the FileSystem provider failed
Fix for a PowerShell 3 startup error caused by disconnected network drives, resolved via a registry key change.
-
C__PowerShell Clipboard Watcher
Implements a clipboard change watcher in PowerShell using inline C# with P/Invoke and WinForms WM_CLIPBOARDUPDATE.
-
PowerShell scripts and "Pattern Main"
Pattern for structuring PowerShell scripts with a Main function so core logic appears at the top before helper functions.