Father, author, blogger, enthusiast of all things PowerShell and automation. http://linktr.ee/mdowst
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.
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!
Just a heads up, I received confirmation from the product team that the AZUREPS_HOST_ENVIRONMENT environment variable is going away. They are moving the backend to containers. Also, the COMPUTERNAME one that was always “client” is going to change too. The COMPUTERNAME will now be “Sandbox-###” with # being random numbers. I started using the code block below in my runbooks to find if they are running in Azure or hybrid worker/locally. It accounts for the current and the updates that will be rolling out in the near future.
$isHybridWorker = $true
if (($env:computername) -eq "CLIENT") {
$isHybridWorker = $false
}
elseif ($env:USERNAME -eq 'ContainerAdministrator') {
$isHybridWorker = $false
}
``
Typically, when I have a script I need to test locally, I’ll comment out the identity connection command and just authenticate outside of my script. If I’m feeling real fancy, I’ll write a try/catch to attempt to authenticate first as the managed identity then if it fails prompt me for credentials. Not the most elegant solution, but it works.
try {
Add-AzAccount -Identity -SubscriptionId $SubscriptionId -ErrorAction Stop | Out-Null
}
catch {
Add-AzAccount -SubscriptionId $SubscriptionId
}
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).
I love WinGet but I just wish there was support for Windows Server, without having to do a bunch of hacks
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 toWrite-Verbose
. Here is a great explanation when to useWrite-Host
vs other outputs.There are also numerous
Write-Output
commands in the script. Anything sent to theWrite-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 theNew-Item
commands in there too, as they will produce output. You might consider saving them to a variable or piping toOut-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 usethrow
. 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.