<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Windows on Vibhu Bhatnagar — PowerShell &amp; Infrastructure Engineer</title><link>https://pwsh.in/tags/windows/</link><description>Recent content in Windows on Vibhu Bhatnagar — PowerShell &amp; Infrastructure Engineer</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Tue, 28 Apr 2026 04:52:05 +0530</lastBuildDate><atom:link href="https://pwsh.in/tags/windows/index.xml" rel="self" type="application/rss+xml"/><item><title>Delete Stubborn Files and Folders on Windows</title><link>https://pwsh.in/posts/delete-stubborn-files-folders/</link><pubDate>Tue, 28 Apr 2026 04:52:05 +0530</pubDate><guid>https://pwsh.in/posts/delete-stubborn-files-folders/</guid><description>&lt;h2 id="what-this-covers">What This Covers&lt;/h2>
&lt;p>You have a file or folder that won&amp;rsquo;t delete — Access Denied, locked by the system, or held open by a running process. This covers three methods to force-delete it: Command Prompt, PowerShell, and scheduling deletion at next boot using Task Scheduler with SYSTEM rights.&lt;/p>
&lt;h2 id="before-you-start">Before You Start&lt;/h2>
&lt;ul>
&lt;li>Run everything as &lt;strong>Administrator&lt;/strong> — right-click CMD or PowerShell → Run as administrator&lt;/li>
&lt;li>Set the path variable at the top of each method — everything else uses it&lt;/li>
&lt;li>This is irreversible. Double-check the path before you run anything&lt;/li>
&lt;li>These methods bypass permission locks — use only on files you own or manage&lt;/li>
&lt;/ul>
&lt;h2 id="steps">Steps&lt;/h2>
&lt;h3 id="method-1-command-prompt">Method 1: Command Prompt&lt;/h3>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-cmd" data-lang="cmd">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">set&lt;/span> TARGET=C:\path\to\locked-folder
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>takeown /F %TARGET% /R /A
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>icacls %TARGET% /grant Administrators:F /T
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#66d9ef">rd&lt;/span> /S /Q %TARGET%
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>&lt;em>For a single file, replace the last line with:&lt;/em>&lt;/p></description></item><item><title>Cut MCP Token Costs 88% with jmunch-mcp</title><link>https://pwsh.in/posts/cut-mcp-token-costs-jmunch/</link><pubDate>Fri, 24 Apr 2026 23:36:10 +0530</pubDate><guid>https://pwsh.in/posts/cut-mcp-token-costs-jmunch/</guid><description>&lt;h2 id="introduction">Introduction&lt;/h2>
&lt;p>If you run Claude Desktop, Claude Code, or any MCP-enabled client through the day, you are burning tokens you never asked for. Every MCP server call that returns a large payload — GitHub issues, Firecrawl scrapes, search results — dumps the entire response into context whether your agent needed three lines or three hundred thousand tokens worth of data.&lt;/p>
&lt;p>&lt;a href="https://github.com/jgravelle/jmunch-mcp" target="_blank" rel="noopener">jmunch-mcp&lt;/a> is a transparent MCP proxy that sits in front of your existing MCP servers and fixes this without changing anything about how you work.&lt;/p></description></item><item><title>Running PowerShell as the Logged-On User from SYSTEM Context</title><link>https://pwsh.in/posts/invoke-vbascurrentuser/</link><pubDate>Thu, 23 Apr 2026 12:00:00 +0530</pubDate><guid>https://pwsh.in/posts/invoke-vbascurrentuser/</guid><description>&lt;p>If you have ever deployed a PowerShell script through Intune, a RMM agent, or Task Scheduler running as SYSTEM, you have hit this wall at least once: the script works perfectly when you run it interactively, but returns nothing — or the wrong thing — when deployed at scale.&lt;/p>
&lt;p>The reason is almost always the same. The script is collecting user-specific data. And SYSTEM is not the user.&lt;/p>
&lt;hr>
&lt;h2 id="the-problem-system-and-the-user-are-not-the-same-session">The Problem: SYSTEM and the User Are Not the Same Session&lt;/h2>
&lt;p>When Intune or your RMM agent executes a PowerShell script, it runs in the SYSTEM context. SYSTEM is a highly privileged account, but it is completely isolated from the interactive user session happening on the same machine at the same time.&lt;/p></description></item><item><title>Managing Printer Mappings Across User Profiles with PowerShell</title><link>https://pwsh.in/posts/printer-mapping-powershell-vb-workstationreport/</link><pubDate>Thu, 23 Apr 2026 10:00:00 +0530</pubDate><guid>https://pwsh.in/posts/printer-mapping-powershell-vb-workstationreport/</guid><description>&lt;p>Printer management at scale is one of those problems that looks trivial until you are staring at 200 workstations, each with multiple user profiles, each with their own mapped printers, and a print server migration starting in two days.&lt;/p>
&lt;p>Doing it manually is not an option. Doing it via Group Policy works for connected machines but breaks for laptops on VPN, offline profiles, and anyone who mapped printers manually outside GPO. What you actually need is something that understands how Windows stores printer mappings per user, can work on both online and offline profiles, and can be deployed from your RMM in a single script run.&lt;/p></description></item></channel></rss>