WSL Crashed and Fixed: A Connection Attempt Failed

Error on WSL You might encounter this error when trying to open your Linux distribution: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. Error code: Wsl/Service/0x8007274c What Is This Error in WSL? The error message: “Error code: Wsl/Service/0x8007274c” is a Windows networking timeout (SocketException 10060 / HRESULT 0x8007274c). In the context of Windows Subsystem for Linux (WSL), it means that wsl.exe cannot connect to the WSL service or the Linux VM backend (WSL - 2). ...

November 27, 2025 · The PwshTips Team

pwsh Start-Job and Wait-Job

PowerShell’s Start-Job is a powerful tool for running commands and scripts asynchronously as background processes. However, its behavior, especially when combined with Wait-Job and -Credential, often leads to confusion. This post demystifies how Start-Job works, why some installers fail silently inside jobs, and how to properly manage background tasks in PowerShell. Assigning Start-Job to a Variable: Why It Matters Consider these two commands. They both launch a background job to run a command prompt instruction. ...

November 26, 2025 · The PwshTips Team

Windows Defender Firewall: Management

The Windows Defender Firewall is a critical component of Windows security, controlling inbound and outbound network traffic to protect your system from unauthorized access and malicious activity. While often misunderstood, managing it effectively is essential for both security and application functionality. This post clarifies the distinction between “Windows Firewall” and “Windows Defender Firewall,” and provides command-line and PowerShell methods to manage its state (on/off) and configure rules. 1. “Windows Firewall” vs “Windows Defender Firewall” The naming of Windows’ built-in firewall can be a source of confusion, but the reality is simpler than it seems. ...

November 13, 2025 · The PwshTips Team

$PSScriptRoot & %~dp0: Script's Home

When writing portable scripts, one of the first challenges is locating files relative to the script itself. Whether in PowerShell or a classic Batch file, you need a reliable way to find your script’s “home” directory. This guide breaks down the two most important tools for this job: $PSScriptRoot for PowerShell and %~dp0 for Batch. 1. The Batch Method cd /d %~dp0 In Windows Batch scripting (.bat, .cmd), the magic variable %~dp0 is the standard for getting the script’s directory. It’s often used with cd to change the working directory. ...

November 12, 2025 · The PwshTips Team

Credential Elevation in Invoke-Command

Credential Elevation in Invoke-Command – The Full Truth When using PowerShell’s Invoke-Command for remote administration, understanding how credential elevation works is crucial. Many misconceptions exist, especially regarding a non-existent -RunAsAdministrator flag or UAC prompts. This post clarifies the real mechanics behind running commands as an administrator remotely. 🔍 Quick Summary Question Answer Does Invoke-Command have a -RunAsAdministrator flag? ❌ No, this flag does not exist. How does elevation actually work? ✅ Elevation is entirely determined by the -Credential parameter you pass and the nature of the remote process. 1. How Invoke-Command Handles Credentials and Elevation Invoke-Command operates by establishing a remote session (typically via WinRM) using the credentials you provide. The elevation of the commands executed within that session depends directly on the privileges of the user account associated with those credentials. ...

November 12, 2025 · The PwshTips Team

Fix 'Access Denied' (Error 5) on Network Shares

Encountering “System Error 5 has occurred. Access is denied.” when trying to access a Windows network share can be frustrating. This error typically indicates that while the client can reach the server, the server is rejecting the connection for security reasons. This often happens when trying to connect as a non-domain user or when guest access is not properly configured. This guide will walk you through the common causes of “Access Denied” (Error 5) and provide clear, step-by-step solutions to fix it. ...

November 11, 2025 · The PwshTips Team

Fix 'Path Not Found' (Error 53) on Network Shares

“System Error 53 has occurred. The network path was not found.” is a common and frustrating error when trying to access a Windows network share. Unlike “Access Denied” (Error 5), which means you’ve reached the server but were rejected, Error 53 means your computer cannot even find a route to the server. This error almost always points to a problem with network connectivity or name resolution. This guide will walk you through the steps to diagnose and resolve this issue. ...

November 11, 2025 · The PwshTips Team

Fix 'SMB Signing Required' Errors on Network Shares

When attempting to create a new item on a Windows network share, you might encounter a security-related error that prevents the connection: “New-Item: You can’t access this shared folder because your computer is configured to require SMB signing. These policies help protect your PC from unsafe or malicious devices on the network.” This error indicates a security policy mismatch between your client machine and the server hosting the share. It’s not a permissions issue, but rather a conflict in how the two machines handle the integrity of SMB (Server Message Block) traffic. ...

November 11, 2025 · The PwshTips Team

gsudo vs. Invoke-SSHCommand for Admin Tasks

Automating administrative tasks on Windows often requires running scripts with elevated privileges. When you can’t have a UAC prompt interrupting your workflow, you need a reliable, non-interactive way to elevate. Two powerful and modern approaches to this problem are gsudo for local elevation and Invoke-SSHCommand for remote execution. This guide provides a deep dive into both tools, comparing their strengths and weaknesses to help you decide which one is the right fit for your automation needs, whether you’re managing a local machine or a fleet of remote servers. ...

November 10, 2025 · The PwshTips Team

Non-Interactive Elevation on Windows

Automating tasks that require administrator privileges on Windows presents a common challenge: how do you handle the UAC (User Account Control) prompt in a non-interactive script, such as in a CI/CD pipeline or a scheduled task? Attempting to bypass UAC is a major security risk and is not recommended. Instead, you should use tools and methods that are designed for non-interactive elevation. This guide will cover the two best approaches: using the open-source gsudo tool for scripted elevation and the built-in Windows Task Scheduler. ...

November 8, 2025 · The PwshTips Team