Save Powershell Modules For Offline Storage

Just a quick How:To that came to mind


1. Open Powershell 5.1 or later
2. Determine a save location. In my example an SMB storage location will be used
3. If you are not sure of the name of the powershell module you are looking to save offline utilize the Find-Module *name* command. Under the name column will be the PSGallery name
4. Run the command Save-Module -Path “File location” -Name vmware.powercli. In the picture below you can see both step 3 & 4 shown as well as the progress when saving the module(s).

End Your Work Day With A Script

Trying to give myself things to learn with Powershell. I thought, “what’s a good way of forcing myself to disconnect from Teams/Slack as that shows me as available to the company I work for”. We’ll I came up with a little script that finds the time and then starts/stop services based -gt (greater than) times.

##################################################################
#   Scripts purpose is to stop you from working after 5:00 PM &  #
#   start service when you need to work                          #
##################################################################

#Get time
$OOP = Get-Date

#Strategy

if ($OOP -gt '5:00 PM') {
    Get-Process Teams, slack | Stop-Process -Force
}
elseif ($OOP -gt '8:00 AM') {
    Get-Process Teams, slack | Start-Process -Force
} 

A sample of the script is above ^. If you would like to automate this daily you would just have to simply open Task Scheduler and set up the script to run weekly with the preferred week days. Remember to set the application to powershell.exe -File “Path to script” in the variables of the task schedule. Two will be needed if you want to start and stop the day.

Use Powershell to get Dot.Net Information

Below is a script that I had used to find the version of Micrsoft’s Dot Net Framework software. Sometimes you may not find the install version in control panel and you do have other ways to find it through reg or the properties of a DLL file. Why not do everything through Powershell though

Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version,Release -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version, Release

With the script above… You can copy and paste that into a non-administrative Powershell ISE window. As shown below you will see what the script looks like pasted, ran, and what the output should look like

After running the above script and confirming it works for your use. You can then save as and save it under your script collection to run when needed. In my particular case I run this through SCCM on demand when I need to know what the .NET version is for the CAS, DP, MP, CMG, ETC especially when more requirements come out for newer versions.