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

PowerShell Remoting: WinRM vs. SSH

PowerShell is the go-to tool for automating tasks on Windows, and its remoting capabilities are a cornerstone of its power. For years, WinRM (Windows Remote Management) with the Invoke-Command cmdlet has been the standard. However, with the rise of cross-platform development and the native integration of OpenSSH in Windows, a new contender has emerged: Invoke-SSHCommand. Both cmdlets let you run commands on remote machines, but they operate on fundamentally different protocols. Understanding the difference is key to choosing the right tool for your environment. This guide breaks down the pros, cons, and best use cases for each. ...

November 9, 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

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

Manage Pinned Taskbar Items with PowerShell

For system administrators, creating a standardized desktop environment often involves customizing the Windows taskbar. While pinning items is easy for a user, automating the process of listing or unpinning applications can be surprisingly difficult. Windows intentionally does not provide a simple, built-in command to manage pinned items to prevent applications from pinning themselves without user consent. However, with a bit of PowerShell scripting, you can gain control over the taskbar. This guide will walk you through the most effective methods to list, unpin, and manage taskbar items programmatically. ...

October 28, 2025 · The PwshTips Team

PowerShell & Bash: Cross-Shell Scripting

In a modern Linux environment, it’s increasingly common to find both PowerShell (pwsh) and Bash installed on the same system. This provides a unique opportunity for system administrators and developers to leverage the strengths of both shells. You can use Bash for its powerful text-processing utilities and then pipe the results to PowerShell for its object-oriented data manipulation, or vice versa. This guide will walk you through the techniques for calling Bash from PowerShell and PowerShell from Bash, enabling you to create powerful, cross-shell automation scripts. ...

October 28, 2025 · The PwshTips Team

PowerShell SSH Remoting: Windows & Linux

PowerShell Remoting is a powerful feature that allows you to run commands on remote computers. While it traditionally used WinRM on Windows, modern PowerShell (pwsh) can now use SSH as its transport layer. This is a game-changer, as it provides a single, secure, and universal protocol to manage your entire fleet of servers, whether they are running Windows or Linux. This guide will walk you through setting up and using PowerShell SSH remoting, from basic commands to a real-world example of deploying an application to multiple servers at once. ...

October 27, 2025 · The PwshTips Team

PowerShell & CMD: Cross-Shell Scripting

In any Windows environment, you’ll inevitably encounter a mix of modern PowerShell scripts and legacy Command Prompt (cmd.exe) batch files. Instead of treating them as separate worlds, you can make them work together. Understanding how PowerShell and CMD can call each other is a crucial skill for any system administrator, allowing you to integrate legacy tools into modern automation workflows. This guide will walk you through the techniques for calling CMD from PowerShell and PowerShell from CMD, enabling you to build powerful, hybrid scripts that leverage the best of both shells. ...

October 27, 2025 · The PwshTips Team

Install PowerShell (pwsh) on Linux

PowerShell is no longer just for Windows. As a powerful, open-source scripting language and shell, PowerShell (pwsh) is now fully supported on Linux, allowing you to manage cross-platform environments, automate tasks, and use a consistent scripting language across your entire infrastructure. This guide provides step-by-step instructions for installing PowerShell on the most popular Linux distributions, including Ubuntu, Debian, Fedora, and Arch Linux. Why Install PowerShell on Linux? Cross-Platform Scripting: Write one script that can run on both Windows and Linux. Object-Oriented Shell: Unlike traditional text-based shells, PowerShell works with objects, making it easier to manipulate and manage data. Powerful Cmdlets: Leverage a rich ecosystem of cmdlets for managing systems, files, and services. Automation: Automate complex administrative tasks across a mixed-OS environment. Method 1: Installing on Debian and Ubuntu This is the most common method and is officially supported by Microsoft. We’ll use Ubuntu 22.04 as an example, but the steps are identical for recent versions of Debian and other Ubuntu derivatives. ...

October 24, 2025 · The PwshTips Team