Powershell ISE: Exploring Repositories With Modules: PowerShellGet and PackageManagement
As I have stated earlier, I am a Novice! If you have more expertise, please feel FREE, to write a “HOW TO” type of Post for the Step by Step procedure that some less exploratory users/People wish they had and may need. This Post is not meant to be THAT, so get out your compass, euphemistically speaking and lets go Exploring, Novice to Beginner. I don’t believe “Adventure” is appropriate because the “Uninstall” cmdlet will undo your mistakes.
Since I don’t do any type of PS that much especially this(once Done, it is done) to establish muscle memory, my main method is usually hunt and peck between these two modules until I achieve what I need to. Inspired yet?
That is not my intention to do. Your Inspirations will come from your successes and achievements, just like mine did and is continuing too!
These Modules are an example of what I call “In Board” Modules. In other words they come with the WMF System Package that brings us Powershell and Powershell ISE, preFound and preInstalled from the ‘WMF Repository'(don’t go looking for this one, you have it all) for your Expansion enjoyment.
What you need to acquire are resources or Repositories for more of the Modules and Script that are open source, written by other People. These are those “RemoteSigned” software that you should have already read about in another Post. There are several Repositories but you only need as many as you want or need. The biggest reason for you to “Set” and/or “Register” (I did both) a Repository, is to make it easier to “Find” and “Install” Modules and Scripts from their respective Repository.
I am going to use PowerShell ISE for this demonstration(You are the demonstrator), so Open: PowerShell ISE now.
Some may like to Change Directories to Root with: (many Command Prompt, CMD(old DOS command line) commands work in Powershell).
PS C:\Windows\system32> cd c:\
Click the CmdLet: (the first time into a module, You will also need to Click “Show Detail”) All of this activity is done on the Right Side Column, when you Click “Run” (bottom Right) the Results will appear in the Left Hand Blue area(unless you have customized the Color). If you fill in the variables and arguments you will see those results after the CmdLet. This it is not necessary.
Click “Run”:
Find in your Modules, drop down menu list:
Click The Module:
Module: PowerShellGet
PS C:\> Get-PSRepository
Name InstallationPolicy SourceLocation
—- —————— ————–
PSGallery Trusted https://www.powershellgallery.com/api/v2/
chocolatey Trusted http://chocolatey.org/api/v2/
PS C:\> Get-InstalledModule (Only Checks on “Program File” Directory not the appropriate “Windows” Directory. I put my mandatory Modules there but you don’t have to).
Version Name Repository Description
——- —- ———- ———–
1.8.0 7Zip4Powershell PSGallery Powershell module for creating and extracting 7-Zip archives
2017.1.14 AU PSGallery Chocolatey Automatic Package Updater Module
0.5 GitHubProvider PSGallery GitHub-as-a-Package – PackageManagement PowerShell Provider to interop with Github
1.3.4 GitLabProvider PSGallery GitLab PackageManagement provider
1.4.1 IsePackV2 PSGallery The Updated ISEPack. Now Way Cooler
1.0 Posh-SubnetTools PSGallery Collection of tools for working with IP subnets
1.2 PSReadline PSGallery Great command line editing in the PowerShell console host
0.1 RoughDraft PSGallery Quick. Quality. Cheap. Please Pick Two.
PS C:\> Get-InstalledScript
Version Name Repository Description
——- —- ———- ———–
1.0 Check-Spelling PSGallery PowerShell script to Spell check Strings passed as parameter, to Identify spelling…
1.0.0.3 Compare-ObjectProperty PSGallery Determine the difference in properties between two objects….
0.2 Get-Github PSGallery Download a github repository or a gist
1.0 Get-GitInfoForDirectory PSGallery The function will use the installed Git For Windows application to …
1.3.5 Get-WindowsUpTime PSGallery Get Windows UpTime StartTime and LocalTime by Wmi on local and remote system
1.0.0 Show-Tree PSGallery Script to show the layout of PowerShell namespaces (Trees) using ASCII
PS C:\>
To “Set” and/or “Register” (I did both) a Repository, use the appropriate cmdlets and don’t forget Copy & Paste is your friend. You don’t have to fill in all of the blanks, just the ones that accomplish what you need. I would start with Repository PSGallery. It will be needed on another Post. In this Module you have Module and Script Install capabilities BUT even better you have Update capabilities for all the Modules and Scripts that have been updated since your Installation. There may be some information that you need below, as well.
Find in your Modules, drop down menu list:
Click The Module:
Module: PackageManagement
Click on CmdLet: (the first time into a module, You will also need to Click “Show Detail”) This Module has excellent cmdlets for as the name says Package(Modules) Management.
PS C:\> Get-PackageProvider
Name Version DynamicOptions
—- ——- ————–
Chocolatey 2.8.5.130 SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, Allow…
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.207 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersion…
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filte…
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent
PS C:\> Get-PackageSource
Name ProviderName IsTrusted Location
—- ———— ——— ——–
chocolatey Chocolatey False http://chocolatey.org/api/v2/
PSGallery PowerShellGet True https://www.powershellgallery.com/api/v2/
chocolatey PowerShellGet True http://chocolatey.org/api/v2/
PS C:\> Get-PackageProvider
Name Version DynamicOptions
—- ——- ————–
Chocolatey 2.8.5.130 SkipDependencies, ContinueOnFailure, ExcludeVersion, ForceX86, PackageSaveMode, FilterOnTag, Contains, Allow…
msi 3.0.0.0 AdditionalArguments
msu 3.0.0.0
NuGet 2.8.5.207 Destination, ExcludeVersion, Scope, SkipDependencies, Headers, FilterOnTag, Contains, AllowPrereleaseVersion…
PowerShellGet 1.0.0.1 PackageManagementProvider, Type, Scope, AllowClobber, SkipPublisherCheck, InstallUpdate, NoPathUpdate, Filte…
Programs 3.0.0.0 IncludeWindowsInstaller, IncludeSystemComponent
If you look carefully, you can see a mistake I made.
The following List is to long for here BUT you can run the cmdlet yourself:
PS C:\> Get-Package
Name Version Source ProviderName
—- ——- —— ————
……..
Don’t be afraid with these two Modules, you can’t really damage anything that you can’t undo, with your hand dandy “Uninstall” cmdlets. C&P is your friend, use it liberally from here to the Blanks on Powershell ISE Right Column of the various cmdlets. Learn from what is put on the Left Blue window. If you can easily remember the cmdlets there variable and arguments, you can do this directly in Powershell Prompt window. I use the PS ISE because of memory problems. You can keep your “HELP” up to date by clicking Update-help under “Help” on the top Menu buttons as well.
--------------------------------------
1. Tower Totals: 2xSSD ~512GB, 2xHHD 20 TB, Memory 32GB
SSDs: 6xOS Partitions, 2xW8.1 Main & Test, 2x10.0 Test, Pro, x64
CPU i7 2600 K, SandyBridge/CougarPoint, 4 cores, 8 Threads, 3.4 GHz
Graphics Radeon RX 580, RX 580 ONLY Over Clocked
More perishable
2xMonitors Asus DVI, Sony 55" UHD TV HDMI
1. NUC 5i7 2cores, 4 Thread, Memory 8GB, 3.1 GHz, M2SSD 140GB
1xOS W8.1 Pro, NAS Dependent, Same Sony above.
-----------------