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

Windows sudo vs. gsudo

For years, Linux and macOS users have enjoyed the convenience of the sudo command to run commands with administrative privileges. Now, the sudo experience has finally come to Windows in two popular forms: Microsoft’s official sudo, built into Windows 11, and the feature-rich, open-source gsudo. But which one should you use? This guide will put them in a head-to-head showdown, comparing their features, security, and best use cases to help you choose the right tool for your workflow. ...

November 8, 2025 · The PwshTips Team

SSH vs. WinRM: PowerShell Remoting

In the world of remote administration with PowerShell, two protocols stand out: the traditional, Windows-native WinRM (Windows Remote Management) and the modern, cross-platform SSH (Secure Shell). Both allow you to execute commands on remote machines, but they are built on fundamentally different technologies and philosophies. Choosing the right protocol is crucial for building a secure, efficient, and scalable automation strategy. This guide will provide a deep dive into both SSH and WinRM, comparing their setup, security, performance, and best use cases to help you make an informed decision. ...

November 6, 2025 · The PwshTips Team

Automate Office 2021 Install & Remove Old Versions

When deploying Microsoft Office 2021, one of the key considerations is how to handle older, existing versions like Office 2010. By default, the modern Office installer will automatically remove these older versions, but for automated or customized deployments, you need more control. This guide will walk you through using the Office Deployment Tool (ODT) to create a silent, automated installation of Office 2021 that also cleanly removes any older Office versions. ...

November 4, 2025 · The PwshTips Team

How to Install PowerShell Modules Offline

In a secure or air-gapped environment, you can’t use Install-Module to download modules directly from the PowerShell Gallery. However, you can use an online machine to download the module and its dependencies, transfer them to the offline machine, and install them manually. This guide will walk you through the process using the popular Posh-SSH module as an example, but the steps can be applied to any module from the PowerShell Gallery. ...

November 5, 2025 · The PwshTips Team

Install OpenSSH Server Offline on Windows

In a secure or air-gapped environment, installing Windows features that normally require an internet connection can be a challenge. A common example is the OpenSSH Server, which is essential for secure remote management. When you run Add-WindowsCapability, Windows typically downloads the package from Microsoft Update. This guide provides two reliable methods for installing the OpenSSH Server on an offline Windows machine (Server 2019/2022 or Windows 10/11), ensuring you can maintain security and manageability even without internet access. ...

November 5, 2025 · The PwshTips Team

Clone a Bootable USB to an ISO

Creating a full, bootable backup of a USB drive as an .iso or .img file is a critical task for IT professionals and tech enthusiasts. Whether you’re archiving a custom Windows installer, preserving a Linux live environment, or creating deployment images, a sector-by-sector clone ensures that the bootloader, partition table, and all data are perfectly preserved. This guide provides three reliable methods to clone a bootable USB drive, catering to different user preferences: the command-line power of PowerShell with WSL, the simplicity of a GUI tool on Windows, and the classic dd command on Linux. ...

November 2, 2025 · The PwshTips Team

Unblock-File Cmdlet in PowerShell

If you’ve ever downloaded a script, installer, or even a help file from the internet, you’ve likely encountered a frustrating Windows security feature: the file is “blocked,” preventing it from running or displaying correctly. This is due to the “Mark of the Web,” a security mechanism designed to protect you from potentially malicious content. PowerShell provides a simple and elegant solution to this problem: the Unblock-File cmdlet. This guide will explain what the Mark of the Web is, how to identify blocked files, and how to use Unblock-File to safely manage them. ...

October 29, 2025 · The PwshTips Team

dsregcmd /status: Windows Identity & Join States

The dsregcmd command-line tool is an indispensable utility for any administrator managing Windows devices in a modern, hybrid environment. It provides a wealth of information about a device’s identity and its join state with both on-premises Active Directory (AD) and cloud-based Azure AD (Entra ID). However, the output can sometimes be confusing. A common scenario is running dsregcmd /status and seeing that AzureAdJoined, EnterpriseJoined, and DomainJoined are all set to NO. While this might look like an error, it simply means the computer is in a standalone workgroup state. ...

October 28, 2025 · The PwshTips Team

Stale Computer Identities in AD & Azure AD

Have you ever removed a computer from an Active Directory (AD) domain, only to find that you can still ping it and connect to it via RDP? This confusing behavior is a common source of frustration for system administrators and is often a symptom of a larger issue: stale computer identities. In a modern, hybrid environment, a single computer can have multiple identities across different systems. Understanding these identities is the key to resolving these conflicts and properly managing your devices. ...

October 28, 2025 · The PwshTips Team