Script to List Various windows items V4.0


Author
Message
RayG
RayG
Advanced Member
Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)Advanced Member (554 reputation)
Group: Forum Members
Posts: 277, Visits: 1.3K
There is a now a ReadMe.txt file contained within the attached zip file.

You will also need to "unblock" the file, right click on the file, select properties and at the bottom check the "unblock" checkbox. This is a security precaution introduced by windows to stop inadvertent execution of files downloaded from the internet. This must be done before extracting the zip file contents.

Following that please unzip the contents into a new directory/folder

This next action may be required to enable scripts to run. If you see the following output:
PS C:\> <path>\GetInstalledProgramList.ps1
<path>\GetInstalledProgramList.ps1 : File
<path>\GetInstalledProgramList.ps1 cannot be loaded because running scripts is disabled on
this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ <path>\GetInstalledProgramList.ps1 -Windo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo    : SecurityError: (:) [], PSSecurityException
  + FullyQualifiedErrorId : UnauthorizedAccess

You will need to look at the execution policy settings on your system open a powershell window and type Get-ExecutionPolicy -list:
PS C:\> Get-ExecutionPolicy -list

   Scope ExecutionPolicy
   ----- ---------------
MachinePolicy   Undefined
   UserPolicy   Undefined
      Process   Undefined
   CurrentUser  Undefined
 LocalMachine   Undefined

If it looks like the above output, I recommend that if you are an administrator you do not do the next step UNLESS you know what you are doing, but create a new user WITHOUT administrator privileges then type the following command:
PS C:\> Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): y
PS C:\> Get-ExecutionPolicy -List

       Scope ExecutionPolicy
       ----- ---------------
 MachinePolicy      Undefined
    UserPolicy      Undefined
       Process      Undefined
   CurrentUser   RemoteSigned
  LocalMachine      Undefined
PS C:\>


After making the above change the script (and any other script) will be able to run.

The simplest of command lines is:
<path>\GetInstalledProgramList.ps1

The script will prompt for every option I suggest just taking the Windows Updates option with no TXT or CSV output, results will be to the console

The most output will be obtained with the following command line:
<path>\GetInstalledProgramList.ps1 -RunAsAdmin -InstalledPrograms -Installe
dStorePrograms -WindowsUpdates -Console -Csv -Txt

Leave out the options you don't want or require there must be at least one output option for the script to run either:
-Console, -Csv or -Txt

If none are given the script will prompt:
<path>\GetInstalledProgramList.ps1 -WindowsUpdates
Do you want a .txt file created? [Y/N]: n
Do you want a .csv file created? [Y/N]: n

The replies of "n" (as above) will result in output to the console.

Edit: 18th Dec 2017.
I have changed the script quite a bit, it still does the same job but the output file names have changed to enable some extra facilities.
1). There is now an HTML output
2). It creates dated files so you can keep as many as you want - there is a "tidy" option to remove files older than 'n' days
3). It will track the differences between runs so you can see what has changed.

I use this as the scheduled options to powershell run as administrator:
-executionpolicy bypass -noprofile "<path>\GetInstalledProgramList.ps1" -WindowsUpdates -InstalledPrograms -InstalledStorePrograms -Html -Txt -Difference -Tidy 30 -Log

Edit: 2018/01/29 & again on 2018/01/30 to fix some typo's and add the version info.
Latest version (Version 3.20) will now provide the following information:
  1) Installed Programs (as seen in Control Panel > Programs & Features,)
  2) Installed Windows Store apps.
  3) Installed Windows Updates
  4) Installed Windows Drivers
  5) Installed Windows Devices
To provide windows devices output a module from the Microsoft TechNet gallery has been utilized. I have included a link to the relevant information in the zip file.

In order to give windows a chance to complete its startup sequence there is now a -Delay <n> where <n> is in minutes so if you create a scheduled task which runs at startup (possibly following a missed iteration) hopefully all the relevant tasks will have completed their startup actions before the script runs to compare two (relatively) stable situation

Edit: 2018-02-17
Thanks to JPHUGHAN and GROVER for their help in ironing out the issues in previous versions, hopefully this one will stand the tests of anyone who decides to give it a try.

Edit: 2018-04-02
Changed file names so script can be run more that once in a day to add items changed between runs to the History file(s)
Some minor bug fixes
It will require:
requires -Version 3.0 -Modules CimCmdlets, DeviceManagement, Dism


Regards
RayG
Windows10 Pro X64 V1809 B17763.194 MR v7.2.3906

Attachments
ExampleOfWindowsUpdates.zip (0 views, 33.00 KB)
GetInstalledProgramList_V4.8.zip (0 views, 55.00 KB)
Edited 2 April 2018 12:11 PM by RayG
Grover
Grover
New Member
New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)New Member (10 reputation)
Group: Forum Members
Posts: 1, Visits: 70
RayG,
First, I would like to compliment you for your scripting and thank you for sharing with us.
I have followed/used each version and the latest version 3.2 is the best yet. The readme file offers a lot of detail
of the various options included within this script.

For those viewers who have not tried this gem, I would recommend that you spend some time and sample some of its offerings.
The ability for the user to print/review what changes or additions has occurred in any or all of the five categories
provides an easy way to track the changes which is occurring in each of our computers every day.
The “differences only” file is especially helpful and easy to view.

Listed below is an extract from Ray’s posting listing the different categories which can be included in each run
of the Windows Powershell program. Any or all of the categories can be included in a single run of the script.

   Installed Programs (as seen in Control Panel > Programs & Features,)
   Installed Windows Store apps.
   Installed Windows Updates
   Installed Windows Drivers
   Installed Windows Devices
 
Attached is my pdf showing some of the instructions which I used to produce my printouts and hope the illustrations
are helpful to other users who might want to explore this excellent script.
I chose the pdf format because of its easy page magnification for readable viewing.

GroverH
Attachments
RayG-GetInstalledListing.pdf (3 views, 846.00 KB)
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search