Christopher,
Welcome to the forum.
I have a strong doubt about this.
You could have taken some time to look around and get a feeling what this forum is about and how it works.
This forum is more about helping with specific issues you have with a particular piece of code you wrote yourself and less about complete scripts or modules. There are other forums dedicated to give reviews like
It will be hard to recommend something meaningful since you shared 2 different modules with different versions and you didn’t even share them directly. We have to go to another site and get it from there.
The next thing is … I tend to think that asking for opinions in internet forums is always a really bad idea. Quite often this leads to discussions about irrelevant details.
But since you asked for I will try to give some general tips regarding your code or PowerShell in general.
First of all - your code is very badly formatted. That makes it hard to read and to understand. You may read the …
… before you continue to code on this projects.
You have way to many comments. And there is still a lot of code commented out. Please keep in mind that you ask people to help you for free in their spare time. You should make this task as convenient and easy as possible them. PowerShell code is quite self-commenting. If you know the basics you know what …
Clear-RecycleBin -Force
… does. Even if you’ve never seen this cmdlet before. So no need to add a comment like this:
#Empty Recycle Bin
Speaking of making things easy - Since PowerShell is around for a while already you are most likely not the very first one with a given taks or idea. It is not a shame to make good use of the work others have already done and shared with the world. I’d recommend to search for examples of code for the task you want to acconplish and use what you like. No need to re-invent the wheel again and again.
Your script/module is quite specific. If someone wants to use it and only needs some of the functions you’ve built in the script/module needs to be customized what costs a lot of
effort. The idea of having a module is to wrap up some functions belonging together to make them easier to use. You actually created a script for one specific purpose on one specific environment.
You may start over with lerning about how to create a good function …
Please always read the help topics completely including the examples and you may follow the links in the section “See also”
You should not use Get-WmiObject
anymore as it is deprecated and not cross plattform.
Really often in your code you create variables using a cmdlet and piping it to select opbject … like this for example:
$WinSysLocale = (get-WinSystemLocale | Select-Object Name)
This way you limit yourself to this one particular property of the returned object without gaining any advantage. The better way would be to assign the complete object to the variable and use the so called dot notation later on to access the needed individual properties … like this:
$WinSysLocale = Get-WinSystemLocale
$WinSysLocale.Name
If you know you really need the system locale name only once you still could use
(Get-WinSystemLocale).Name
without creating a variable at all.
You have a lot of “Single Line Functions” you use only once. This way you write at least 4 lines of code to run only one - why? … here’s an example:
You create the function RunGPUpdate
function RunGPUpdate {
GPUpdate /Force
}
and then you run this only once.
# Group Policy Update
RunGPUpdate
… and you even added a comment …
Function names in PowerShell should have the same naming convention like cmdlets - verb, dash, noun. And you should only use approved verbs. You can get a list of approved verbs like this:
Get-Verb | Sort-Object -Property Verb
Using this best practice you could name the function Invoke-GPUpdate
.
I’d recommend to only pay special attention to performance if performance really matters for the task you’re about to accomplish. And if it matters you should measure it ( Measure-Command).
OK … I think that’s enough for now. If you have further specific questions you’re very welcome to come back and ask them.