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.
This one in particular takes around an hour to run. It deploys a bunch of resources to Azure and runs a all of our integration tests. It does a complete wipe and redeploy each time, so it takes a while. Fortunately, this pipeline is only run as a final test before prompting to production, so normally I only run it once a month or so. While it’s running I’ll work on my pull requests, release notes, closing user stories, etc.
That’s why half of my pipelines are just scripts now, so I can run large chunks of them locally. But yeah, commit, test, commit, test, commit, test drive me insane.
Yes, there is oh-my-posh
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.
If I understand correctly, the signatures generated by PuTTY aren’t perfectly random, so if someone got a hold of a bunch of keys from a server, they could figure out the pattern. It takes about 60 keys. This affects not just PuTTY, but also FileZilla, WinSCP, TortoiseGit, and TortoiseSVN.
In other words if you have NIST P-521 keys, or any others using 521-bit ECDSA, you should revoke them and generate new key pairs. After you update your software.
I installed some security cameras around my house and set up Shinobi using an old PC. Unfortunately the PC is too old to use the built-in detectors in Shinobi. So, I took my first dive into playing around with some image detectors.
I wrote some python to download the daily recording from old PC to a newer one with a 3080 GPU. Then checks the videos for people. It will then trim the videos to only include times were there are people in frame. It cut my the storage requirements by over 95%.
Joel “Jaykul” Bennet is an opinionated DevOps engineer, programmer, speaker, and Microsoft MVP.
I love that description. I can’t wait to listen to it tonight!
No Azure DevOps automatically increments it every time you run the pipeline.