Press "Enter" to skip to content

Category: Powershell

Pinging All Day in Powershell

Patrick Gruenauer wants to know if a service is up:

Recently, I have created a script that returns a beep sound when the connection is re-established. I would like to share this script here on my website.

Assume your network connectivity is broken. You wait until the connection is restored. In addition, you want to hear a sound when the connection is re-established. For this task, just use my script.

I’ve done some ping -t checks in my day, though never with a beep.

Comments closed

Getting User Access Lists to All Power BI Reports

Tomaz Kastrun wants to know what you can see:

This way, you will have a better view of users, and their access to data and reports (if these are containing sensible data). You can always retrieve the list of workspaces and access the list of all users with the PowerShell cmdlet Get-PowerBIWorkspace.

I have also added the Join-Object module. It can join two objects or two arrays, based on the given matching columns.

Click through for a Powershell script which does the job.

Comments closed

Try out Chocolatey

Grant Fritchey makes a recommendation:

Chocolatey, as it says on the web site, is a package manager for Windows. But what does that mean? Basically, a package manager is a central place to install, upgrade and remove software. You get a database of the software you have installed, then it can help you to manage your software. Package managers are built into most operating systems. For example, apt or yum on a Linux box. However, not Windows. That’s where Chocolatey comes in.

I do like Chocolatey a lot as well and not just on VMs that I regularly need to rebuild.

Comments closed

Powershell Colors and Icons

Jeff Hill has fun with terminals:

If you have followed along with me before, chances are you know I like color. Color helps me zoom in on the information I want faster. Color can help me know if I have the right number of curly braces. Modern browsers and word processors show a red squiggly line when you misspell a word. Your eye is drawn to that bit of color that is different than the rest of the page. Keep reading and I’ll show you how to add some spice to your PowerShell experience.

I heartily endorse the mention of Windows Terminal later on. If you haven’t tried it before, it’s a worthy successor to CMD and the basic Powershell terminal.

Comments closed

SysInternals EULA Acceptance in Powershell

Jeff Hicks finds your terms acceptable:

I just saw a very, very handy thing on Twitter where you can set a registry key that will automatically accept all EULA prompts for the SysInternals tools. I know there is a command-line switch I can use, but I never remember to use it. Setting the registry key appears to accept EULAs globally. Naturally, I wanted a PowerShell script I could run.

Read on for that script.

Comments closed

Wrapping Get-Credential in Powershell

Stuart Ainsworth writes a script:

Just a quick blog; am working on a script that requires credentials to run against a REST API, and a developer wanted to convert that script to use command-line parameters. I built this script (and quick test) to show that the command-line parameters create the same object as the Get-Credential object.

The one thing that has me on edge a little is that the password comes in as plaintext. I do understand that sometimes this is the best route, though I’d put the pressure on devs to make sure there isn’t a route in which plaintext passwords get encrypted before transmission, even in a local environment like this.

Comments closed

Testing Powershell Scripts

David Wilson provides an introduction to Pester:

Most of you probably know that I’m a big fan of automated testing and especially testing during the development process. It significantly improves the design of the code by encouraging loose coupling and high cohesion. It also provides great documentation and increases the confidence of anyone who needs to change the code in the future (this includes future you)!

Testing does tend to get the short end of the stick when it comes to development time. Some of that is design problems, like David mentions, but I think a lot of it is the “This is a solved problem” mentality we (and I am definitely part of “we” here) end up in: I proved that the solution work because the code compiled and the two scenarios I tried out worked; therefore, why do I need to “waste” the extra time by writing all of these tests when I can move on to something more interesting?

Comments closed

PSWorkItems: Powershell TODOs

Jeffrey Hicks has a new module:

I spend my working days living in a PowerShell console. Over the years, I’ve developed many PowerShell modules to help me manage the chaos that is my work life. One area that always demands attention is managing my tasks and To-Dos. For several years I have been using the MyTasks module. This module stored tasks and supporting information in a set of XML files. The code in the module treated the XML files as databases. I was trying to avoid a dependency on a SQL Server Express installation with the idea that would be overkill.

ln the meantime, I finally got around to finishing and publishing the MySQLite PowerShell module. This module has a set of PowerShell functions designed to simplify working with SQLite database files. This type of database has a much smaller footprint than SQL Server Express and would streamline my task management.

Click through to see how it works.

Comments closed