In Linux shells, there’s a command called “sudo” that lets you run a command with elevated privileges. In PowerShell, you’d have to open a completely new shell with elevated privileges.
Let’s try and add a sudo command to PowerShell. We want a new command called ‘sudo’, and it…
In the previous parts, we created a code signing certificate and used it to add a digital signature to a PowerShell script file. Yet what good can a digital signature do that was added to a PowerShell script file?
Use Get-AuthenticodeSignature to reveal the secrets found in the digital signature. Just…
In our previous tip we explained how you can use New-SelfSignedCert to create a self-signed code signing certificate. Today, we’ll use a self-signed or corporate code signing certificate to actually start and digitally sign a Powershell script.
For this, take any PowerShell script file you want…
Adding a digital signature to a PowerShell script is no black magic anymore these days, and while you ideally need an official “trusted” code signing certificate from your corporate IT or trusted authority, even this is not mandatory anymore these days.
Before we proceed with code signing…
Often PowerShell scripts use a very simple form of error reporting that is structured like this:
# clearing global error list:
# hiding errors:
$ErrorActionPreference = 'SilentlyContinue'
# do stuff:
Stop-Service -Name Spooler
# check errors at end:
In the previous post we introduced the Windows tool cleanmgr and its parameters /sageset and /sagerun that you can use to define and run automated hard disk cleanups.
Today we’ll be looking into how you can customize the actual cleanup tasks performed by cleanmgr.exe.
This tool stores all configuration…
Part of Windows is an ancient tool that can clean your hard drive: cleanmgr.exe.
This tool can remove a variety of data garbage and at times removes many gigabytes of space. What makes it interesting for PowerShell is its support for automation.
To automate hard drive cleanup, first you need to launch…
If you’d like to programmatically unpair a paired Bluetooth device, then there is no built-in cmdlet available. Still PowerShell can do the trick, and it often can even unpair Bluetooth devices that won’t remove via the UI or keeps coming back.
What you need first to remove a Bluetooth device…
If you’re just looking for a quick way in Windows to pair and unpair Bluetooth devices, try this command:
PS> explorer.exe ms-settings-connectabledevices:devicediscovery
It immediately pops up a dialog showing all Bluetooth devices. Just add a function to PowerShell so you don’t have…
Identifying Bluetooth devices that your computer has connected to is as easy as a one-liner:
PS> Get-PnpDevice -Class Bluetooth
Status Class FriendlyName InstanceId
------ ----- ------------ ----------
Powered by IDERA