This repository contains a collection of PowerShell modules that contain tools to help you work with the Windows platform. The modules have been published to the PowerShell Gallery.
To prevent function name collisions, every function has a prefix of GC
being my initials.
All of the PowerShell modules in this repository have been published to the PowerShell Gallery. This makes the installation of the modules extremely easy.
Judging from the PowerShellGet repository you should be able to install these modules as long as you have PowerShell v3.0 or later installed on your Windows platform. To see what version of PowerShell you have running, open PowerShell and issue the command $host
taking note of the version value.
If you wish to upgrade PowerShell on your system see the Windows Management Framework page.
- Open PowerShell As Administrator and type the following commands.
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
- This command changes the PowerShell Execution Policy.
- This is only needed to be executed once on each system.
Install-PackageProvider -Name NuGet -Force
- This command installs support for the PowerShell Gallery.
- This is only needed to be executed once on each system.
Install-Module -Name <GC Module Name> -Force
- Replace
<GC Module Name>
with the module you want to install.
- Replace
That's all it takes. You can now execute any of the functions listed in the installed modules from PowerShell.
To verify the installed modules type the following command into PowerShell:
Get-Module -ListAvailable -Name GC*
Some of the modules have other dependencies so you may see more than one of the GC*
modules installed.
- GCDialog: User interface components for building scripts.
- GCHostsFile: Hosts file management tools for local name resolution.
- GCTest: Basic True/False system tests.
- GCWindowsUpdate: Control the Windows Update background service.
Install-Module -Name GCDialog -Force
The GCDialog module contains user interface functions to help you build scripts that require user input.
The GCDialog module contains the following functions:
- Start-GCConsoleTimeout: Console based timeout progress bar with cancel support.
- Start-GCTimeoutDialog: WPF based timeout window with time remaining and two buttons support.
Install-Module -Name GCHostsFile -Force
The GCHostsFile module contains a number of functions to help you manage the hosts file on the Windows platform.
The hosts file is the first place Windows checks for name resolution. It is loaded into the DNS cache whenever it gets updated.
Read more about the hosts file on Wikipedia
The GCHostsFile module contains the following functions:
- Add-GCHostsFileEntry: Add host entries to the hosts file.
- Clear-GCHostsFile: Delete all contents of the hosts file.
- Export-GCHostsFile: Create a copy of the hosts file.
- Get-GCHostsFileEntry: Retrieve hosts file entries as PSCustomObjects.
- Import-GCHostsFile: Replaces the hosts file with a source files contents.
- Install-GCHostsFileBlockList: Installs a block list managed by Steven Black.
- Open-GCHostsFile: Opens the hosts file in notepad.exe.
- Remove-GCHostsFileEntry: Removes entries from the hosts file using filters.
- Set-GCHostsFileEntry: Updates or adds hosts file entries.
Install-Module -Name GCTest -Force
The GCTest module contains Test-GC*
functions for simple True/False system tests.
- Test-GCAdminShell: Test the console to see if it is running 'as Administrator'.
- Test-GCFileWrite: Test for write permissions on a file.
Install-Module -Name GCWindowsUpdate -Force
This module contains functions to interact with the Windows Update service.
I have lost data from open applications because Windows Update decided to reboot on me without retaining current state. After this happened a few times I decided to disable the Windows Update service. This worked well letting me update the platform when I wanted to update. After manually enabling and disabling the Windows Update service I wrote these functions.
Warning: Calling Stop-GCWindowsUpdate
will disable the Windows Update background service. This will prevent your system from installing updates until you start the service or run Start-GCWindowsUpdate
.
- Start-GCWindowsUpdate: Downloads and installs update packages.
- Stop-GCWindowsUpdate: Stops and disables the Windows Update service.