Father, author, blogger, enthusiast of all things PowerShell and automation. http://linktr.ee/mdowst
Just looking at it from the point of view of making the script more portable and easier for someone else to run, there are a few things I would address.
The first is the Write-Host
commands all over the script. I would recommend converting those to Write-Verbose
. Here is a great explanation when to use Write-Host
vs other outputs.
There are also numerous Write-Output
commands in the script. Anything sent to the Write-Output
will be returned to the calling console. If you need to take additional actions based on the results of this script, this could cause issues. You can run into problems with the New-Item
commands in there too, as they will produce output. You might consider saving them to a variable or piping to Out-Null
.
Also, there is no need to call exit and set an exit code in the way you are. If you want to write and error but have the script continue you can use, Write-Error
. If you want the processing to terminate then use throw
. Doing it this way will allow PowerShell’s built-in error handling to take care of the exit codes. It will also give you greater flexibility with using Error Action Preferences and using try/catch statements.
Finally, you have a path hardcoded for the workingDir. I would suggest making this a parameter or using an environment variable as this will make it more portable. Also, when creating the log variable, you will want to use the Join-Path cmdlet instead of just joining strings.
ConvertTo-InteractiveHTML
function. Doug walks through generating HTML tables with sortable columns and customizing them using AI. Whether you’re managing large datasets or need a quick way to visualize your data, this tutorial will guide you through the process. Install the PSAI module and start making your data more dynamic.I remember before scrambling they just put blocks that prevented you from going to certain channels. I somehow figured out if you ran the cable box through the VCR first and put it on channel 2 while the TV was still on 3, it would shift all the channels down one. Cinemax was channel 14, which our box just would not go to. But it would go to 13, so doing my little trick teenage me got to watch a lot of skinamax.
It took me longer than I would have liked, but I did finally get the next video uploaded. I hope you enjoy it as well.
Nice write up, and a great primer for someone coming from the Linux/Bash world.
Thanks! I’d love to hear your thoughts once you’ve watched it.
Thanks! I’m glad to hear you are finding it useful.
Thanks! I’m glad to hear others are finding it useful.
For some reason their API would not return anything for assembly. I was curious to see where it would rank too,
Apparently it due to an issue with Kotlin - https://github.com/code-golf/code-golf/issues/151#issuecomment-1126266250
Biggest things I’m seeing is CVE-2023-21709 for Exchange requires a PowerShell script to be run after patching. Also, CVE-2023-29328/29330 for Teams affect all devices (Windows, Mac, iOS, and Android).
The book I wrote. When I first talked with the publisher he asked, “what skills would you look for in someone who wants to do your job?” And that’s the premise I stuck with writing it.
Interesting. As someone who mainly deals in PowerShell, this is very similar to the Where-Object clause and could save me some headaches when I need to work in Python.
I’ve actually had an excavator take out my network. I’ve also had networks taken out by forklift, train, and a semi-truck towing three other semi-trucks.
No Azure DevOps automatically increments it every time you run the pipeline.