Unblock downloaded PowerShell scripts

Blocks

CC 2.0 image courtesy sima dimitric on Flickr

When you download and try to run a PowerShell script (a .ps1 file extension) from the internet, you see the following security warning:

Run only scripts that you trust. While scripts from the internet can be useful, this script can potentially harm your computer. If you trust this script, use the Unblock-File cmdlet to allow the script to run without this warning message. Do you want to run {script name}?

Block01

Read more of this post

Advertisements

Command Prompt & PowerShell Presentation Settings

Fonts

CC 2.0 image courtesy Marco / Zak on Flickr

As a public speaker and someone who helps run a user group, I see a lot of presentations by developers. One thing devs sometimes forget is that their everyday settings are not always suitable when projecting to a crowded room. One of these settings is the font and window size of both Windows Command Prompt and Windows PowerShell.

This article shows you how to bump up your fonts in these tools.

Read more of this post

PowerShell Execution Policy Settings

Shell

CC 2.0 image courtesy GarrettTT on Flickr

If you have ever tried to run a PowerShell script on a new system, you probably have encountered the following error: “{File Name} cannot be loaded because the execution of scripts is disabled on this system. Please see “get-help about_signing” for more details“.

PS01

This post looks at the solution to resolve this issue.

Read more of this post

Running Jekyll on Windows & Azure

book pages

CC 2.0 image courtesy Sebastien Wiertz on Flickr

In my previous article, I outlined all the steps needed to install Jekyll (the open-source static site generator) on a Windows 10 environment. In this article, we will build our first Jekyll site and serve it up via localhost. Then we will push the site to Azure Web Apps and host it via Azure App Service.

Read more of this post

Installing Jekyll on Windows

Library

CC 2.0 image courtesy Fredrik Rubensson on Flickr

I have wanted to experiment with Jekyll for some time but I was hampered because Jekyll is a Ruby Gem. Granted, I could have created an Azure VM with a Linux distro but I wanted something native on my machine. So, I was excited to see in the official Jekyll installation docs that a workaround for running Jekyll on Windows 10 exists.

Read more of this post

More zombie process destroying scripts

Kill Your Zombie Process I wrote an article a few months back entitled Killing zombie Google Chrome processes. In the post, I talk about the fact Google Chrome can spin off multiple processes during a browsing session. When you close the browser window sometimes Chrome can leave behind several zombie processes in the Windows Task Manager.

Within the article, I presented two ways to solve this problem. I showed a PowerShell command and I also mentioned a fix through a batch script I created. I uploaded a copy of the Stop Google Chrome Processes batch script file to the TechNet Gallery.

Since then, I have created a similar batch file for other web browsers including Firefox, Explorer, Edge and Opera. All can be downloaded from the TechNet Gallery via the links below.

Killing zombie Google Chrome processes

This article is also available on the Microsoft TechNet Wiki.

When using the Google Chrome browser with of mix of normal and incognito windows, long-running sessions with multiple tabs can sometimes chew up a lot of memory. It certainly does not help either that Google Chrome spawns 10+ processes for any given browsing session. So when it comes time to close these browsing sessions it is not uncommon for Chrome to leave behind several zombie processes in the Windows Task Manager.

ChromeProcesses01

To terminate these remaining processes you can right-click them in the Task Manager and select End task. However, there is a faster way using either a PowerShell command or Windows Batch (.bat) file. Let’s examine both ways.

PowerShell

Within PowerShell, there is the Stop-Process Cmdlet. This will allow you to terminate all processes in one command. You can kill the process either by process name (minus the file extension) or by process ID. Since we want to end all Chrome processes, we would use the -processname parameter combined with the process name:

Stop-Process -processname Chrome

You can enter this command into the PowerShell window or save it to a PowerShell script (.ps1) file that you can run from the Windows PowerShell ISE.

Batch File

Another, simpler, way is to create a Batch (.bat) file. A batch file is a script used in Windows. It lists commands that can be run using the command line interpreter when the file is either called from the Command Prompt or double-clicked.

To stop processes, we can execute the taskkill command:

taskkill /F /IM chrome.exe /T

This command will use these parameters:

  • /F: Identifies that process(es) be forcefully killed.
  • /IM: Identifies the image name of the process to be killed
  • /T: Kills all child processes along with the parent process, commonly known as a tree kill
    If we combine this with a For Loop we can see the number of processes being terminated:

ChromeProcesses02

When run, the script will pause to display all terminated processes including the associated process ID (PID). As well, the total number of Google Chrome processes removed is also listed.

Conclusion

In this article, we saw how we can use both a PowerShell command and a Batch file to terminate hanging or zombie Google Chrome processes. Try either method if you have problems with Chrome processes remaining on your machine after all sessions are closed.

Script

Download a copy of this Batch script file from the TechNet Gallery:

References