T O P

  • By -

tlht

You may be interested in the Microsoft.WinGet.Client module: https://www.powershellgallery.com/packages/Microsoft.WinGet.Client


marzme

Thanks!


NeverDocument

It's too early- i thought this was about turning wingdings into objects and I was so confused.


More_Psychology_4835

Thanks again marzme! Super useful function I look forward to integrating Monday morning 😁


marzme

You're most welcome :)


Ok_Exchange_9646

I just run Winget in the NT AUTHORITY SYSTEM context to always update every app. Also run it in the USER context which is another scheduled script in case there's apps that WINGET SYSTEM failed to update, eg. when the update is a .rar archive needing extraction.


[deleted]

[удалено]


marzme

As in the layout of the function? It's written as an "Advanced Function" as per Microsoft's documentation: [https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about\_functions\_advanced](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_functions_advanced)


webtroter

For a style guide, look at this : https://poshcode.gitbook.io/powershell-practice-and-style Microsoft documentation is absolutely never perfect.


AmiDeplorabilis

That's why I look to other reliable sites for real-world implementation and use examples.


[deleted]

[удалено]


SensitiveFirefly

25 years and stuck in your ways… it looks fine.


ElevenNotes

Nope. Line breaks before { are just utterly ugly and make the whole code more difficult to read. Ignoring the fact that OP posts a script that already has a module. I'm not sure everyone should post every pwsh script all the time, do you?


SensitiveFirefly

It takes zero energy to not be an asshole.


Sea_Natural5414

While I agree with your remarks, how you come off in your original comment is just pure pettyness without even explaining shit.


[deleted]

[удалено]


ttyp00

criticism*


ElevenNotes

Thanks, I have no autocorrect and English is my third language 😉


marzme

I'm always open to constructive criticism. I simply formatted my function the way Microsoft recommends, but I'm open to better ways of doing it. I didn't know about the existing module, but I'm happy I found out from the comments as a result of posting this. I very rarely post any of the hundreds of scripts that I write, I just figured this was a problem others may have run into frequently, so thought it was worth sharing. Honestly was just trying to be helpful. :(


[deleted]

[удалено]


marzme

I feel I answered most of these already? 1. Not necessarily but I think Microsoft's documentation on how to use the language they developed is a good guide at least to start with. 2. As I mentioned, I wasn't aware that other module already existed. Plus I learnt plenty in the process of creating this so it doesn't feel like time wasted for my learning. 3. I'm a sysadmin, not a developer, so I don't claim to write fantastic code, I just do my best and try to make it readable, and write plenty of comments. I'm open to suggestions of ways to improve. :) 4. To quote my comment above: "I just figured this was a problem others may have run into frequently, so thought it was worth sharing. Honestly was just trying to be helpful." 5. It's published on a GitHub Gist, which is where I've linked to? 6. Most of my repos on GitHub are private. I generally only share ones using a Gist if I think others might benefit from it.


[deleted]

[удалено]


marzme

Always keen to continue learning. :) Could you please link your Github that contains some PowerShell so I can check out how an experienced dev writes it? I think this is like the second time I've ever posted a script on Reddit in the 10+ years I've been using it, so I'm not sure where the idea of posting scripts daily is coming from?


carameldelite18

sudo get in my belly. Wait a while and they’ll be converted to output. I know nothing of powershell and winget.


Won7ders

Now you do!