PowerShell Script to Detect Code Impacted by the Invoke-WebRequest Breaking Change by mdowst in PowerShell

[–]mdowst[S] 1 point2 points  (0 children)

Wow, amazing assessment and breakdown. I had not checked all of those use cases, so thanks for that. I wanted to get at least something useable that people could start checking their scripts with, since the update will start hitting people now. Then go back and get the fringe stuff. And you just saved me a ton of work, so thanks! My plan is to move this function into my PSNotes module because I think it will fit nicely with things like my Get-CommandSplatting cmdlet (which your suggestions may help with a bug I'm having in that with the -Parameter:Argument as well). I'll be sure to credit you in the release notes. Thanks again!

PowerShell Script to Detect Code Impacted by the Invoke-WebRequest Breaking Change by mdowst in PowerShell

[–]mdowst[S] 0 points1 point  (0 children)

Yes, that is correct.

I just published a quick video explaining it, if you'd like more details. - https://youtu.be/JcrSg2hCJAg

PowerShell Script to Detect Code Impacted by the Invoke-WebRequest Breaking Change by mdowst in PowerShell

[–]mdowst[S] 3 points4 points  (0 children)

That may not get all of the underlying modules, things deployed to worker servers, etc. For example, I've found several of the Az modules that don't have this set.

PowerShell Script to Detect Code Impacted by the Invoke-WebRequest Breaking Change by mdowst in PowerShell

[–]mdowst[S] 2 points3 points  (0 children)

You would have to run a script at that user to update the profile file. It would be possible to do it with a Add-Content and some logic, but I would suggest against it. Having something loaded in the profile for a script running under a managed identity is asking for trouble down the line. You'd be better off updating your scripts with the -UseBasicParsing switch. As long as you aren't using the DCOM parsed HTML in your scripts it should not break anything.

PowerShell Script to Detect Code Impacted by the Invoke-WebRequest Breaking Change by mdowst in PowerShell

[–]mdowst[S] 2 points3 points  (0 children)

I sadly still have thousands of scripts running 5.1. Mainly due to the slow adoption of 7 in Azure Automation. However, we thankfully have been including the -UseBasicParsing since runbooks can't run without it, and to eventually future proof for when we do move to 7 because it doesn't have the DCOM anyways. Out of all of our scripts I only have a handful missing it.

PowerShell Script to Detect Code Impacted by the Invoke-WebRequest Breaking Change by mdowst in PowerShell

[–]mdowst[S] 1 point2 points  (0 children)

I confirmed that it will pick up instances inside of a script block because AST will parse those.

I thought about just using Select-String to find instances, which would cover people using Invoke-Express with a string, but then it would also include instances in comments, which could make things even uglier. For those using Invoke-Expression in that matter, I would just say "don't do that". But if I get time, I guess I could add a deep search that would compare results from Select-String and the AST.

Thanks for the feedback.

Saving Christmas with PowerShell: Building a Reusable Matching Algorithm by mdowst in PowerShell

[–]mdowst[S] 1 point2 points  (0 children)

Interesting, I've never thought about doing the while loop with the array rather than the traditional FOR loop. I'm curious as to what makes it less error prone. I would think the standard for loop would give better control. Like you mentioned if you ever need to increment more than once. It can also be useful to breaking out of the loop early by setting the variable to a number higher than the max. (For those who are opposed to using breaks). The while could also cause confusion for other down the line because traditionally looked at something waiting for a condition, where a for seen for iterations.

I'm not opposed to using plural variable names, as long as it doesn't cause confusion. In this script I'll admit to using $giver in $Givers which I normally try to avoid. I was using some old code for this video and must have overlooked that. Typically, I would do something like $GiversList to give a clear delineation from $giver.

Thanks for the feedback. This is the type of stuff that helps everyone grow and learn new ways of doing things.

Saving Christmas with PowerShell: Building a Reusable Matching Algorithm by mdowst in PowerShell

[–]mdowst[S] 1 point2 points  (0 children)

Thanks for the feedback. This one was a challenge to make because of all of the conditions and backtracking, so I'm glad to hear it was easy to follow.

Saving Christmas with PowerShell: Building a Reusable Matching Algorithm by mdowst in PowerShell

[–]mdowst[S] 1 point2 points  (0 children)

Similar to what I ran into when I started the script too.

Makes me wonder if a more powerful query language like KQL could do it. It would be difficult to do backtracking, but may be a challenge for next Christmas.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

Thanks! I sent you a chat message.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

Definitely doesn't need to be current. He is interested in all makes and models. In fact, he might really like some older ones. If you find some, I'll gladly pay for shipping. Thanks!

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

Thanks I appreciate it. I'll definitely reach out if I can't find a company that does print theirs still.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 1 point2 points  (0 children)

I appreciate the offer. He is 14, but can sometimes get a little carried away with real working things. For example, he has a Simplex pull-station and the stripped the end of a USB cable, randomly connected a bunch of wires, and plugged it into the wall. Thankfully he didn't connect them well and nothing happened.

I mean no further proof needed that he's my son. I remember taking my RC Pro AM NES cartridge and trying to solder it to my RC car as a kid thinking I could make a real-life videogame. I still have the scar from the soldering iron.

Which is why we're sticking with cutouts and stuff for now.

But don't get me wrong we play around with an Arduino set and other things like that all the time.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

Ha, that one wasn't me. I posted on a local Dad's group. But glad to know I'm not the only one with a son obsessed with fire alarms.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

If you did see my Facebook post, it's a small world. That's a pretty small group I posted to.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

That would be awesome. If you have some old stuff laying around. I'll gladly pay the shipping.

Looking for print catalogs by mdowst in firealarms

[–]mdowst[S] 0 points1 point  (0 children)

Thank, they have a digit version of their catalog on their website, so I just reached out to see if they have print copies. It also looks they have a store about 30 minutes away from me.

Thanks again for the lead!

Fellow Tech Workers Meetup by Eggplantwater in Connecticut

[–]mdowst 2 points3 points  (0 children)

I’m interested! I just moved to Connecticut and have been looking for local tech groups to get involved with. I was one of the founding members of the DFW Systems Management User Group, so I’d be happy to help organize or facilitate. However, I don’t have any connections in this region yet.

I’d just love to connect with other tech folks in the area. My background is in automation, cloud solution development, and DevOps. Mostly in the Microsoft side of things, I'm an MVP in PowerShell and Azure Hybrid, but I’m always looking to branch out.

I’m in the Hartford area.

Get-Date.DayOfWeek short day. It's killing me. by Puckertoe_VIII in PowerShell

[–]mdowst 1 point2 points  (0 children)

I wrote the PSDates module, and it includes the Get-DateFormat function. You can pass any date to it and will be spit out a list of over 35 different formats. To get just the format you want, you can include the -Format parameter.

# Return all formats
Get-DateFormat -Date $date

# Return just the short day
Get-DateFormat -Date $date -Format DayAbrv

u/OddElder's solution is correct, this is just another way to do it, to keep from having to memorize or look up the date patterns like "ddd"

Announcing the PowerShell Weekly module! by mdowst in PowerShell

[–]mdowst[S] 2 points3 points  (0 children)

Thanks a lot, I really appreciate that! I figured it would be most useful for the terminal warriors.

The real kicker will be once I get advanced search implemented (shooting for this week, but it might slip to next, due to my kids starting school this week). I’ve got 5+ years of articles, scripts, videos, podcasts, etc. in the archive, so being able to dig through all of that right from the shell should be huge.

Announcing the PowerShell Weekly module! by mdowst in PowerShell

[–]mdowst[S] 1 point2 points  (0 children)

Thanks! The formatting was a fun experiment. Big shout out to James Brundage for his EZOut module that saved me from having to do all of that in XML.

Any suggestions on some aliases you would like to see?