|
Zaepho posted:Have you looked at https://psappdeploytoolkit.com/? It has a bunch of pre-canned stuff specifically for app deployments that you might be able to make use of and let somebody else maintain and improve. It is certainly something I've considered, when we get enough breathing room that I can start looking at better solutions, but for the moment, I've got an overwhelming backlog of several thousand applications that I have to review, so I fix what I can, and push the big stuff to next year's Toshimo.
|
# ¿ Jun 9, 2022 04:46 |
|
|
# ¿ May 15, 2024 18:50 |
|
New Yorp New Yorp posted:This is insane and needs to be fixed immediately. There is zero excuse to not use source control and any manager who hasn't enforced it years ago is straight up incompetent. Yeah, we just have everything tossed up on a SMB share. My boss is all for source control, as is my team, and I've got a BitBucket set aside for it, but I haven't had enough time to figure out how I'm going to use it (again, we've got several thousand scripts that never really get updated, so it's a weird case). I'll look into Pester, thanks.
|
# ¿ Jun 9, 2022 07:03 |
|
I am losing my goddamn mind and this has to be the simplest thing.PowerShell code:
Output: --- File Contents: Alpha,1,2/3/22,22.99,76.70,123-45-6789 Beta,999,4/5/1999,.75,63.69,234-56-789 --- Alpha,1,2/3/22,22.99,76.70,123-45-6789 Beta,999,4/5/1999,.75,63.69,234-56-789 Name Value ---- ----- domain CONTOSO user jsmith 0 was CONTOSO\jsmith Why the heck is $Matches not populating and why am I not getting a boolean output from -match? Toshimo fucked around with this message at 19:10 on Aug 10, 2022 |
# ¿ Aug 10, 2022 19:08 |
|
Thanks, yeah, I forgot that Get-Member doesn't tell you that it's an array unless you use -inputObject because reasons... Which I still don't think -match should just drop on the floor, but here we are.
|
# ¿ Aug 10, 2022 19:28 |
|
Toast Museum posted:To come at the problem from another direction, if the sample data is representative of how the real data looks, have you considered using Import-Csv instead of messing around with regex? I did, but it's not my data, and the only thing the person wants is to be able to change the money amounts easily, instead of having to do it in excel one-by-one. I had expected it to be a quick thing I knocked out over coffee until I got side-tracked over -match being buggy.
|
# ¿ Aug 10, 2022 23:54 |
|
New Yorp New Yorp posted:Use import-csv and export-csv. They are designed for reading and writing csv data. I understand what they are for, but I have never seen the data, so I don't even know if they are in legit CSV format or anything.
|
# ¿ Aug 11, 2022 01:22 |
|
Losing my drat mind on this one. Got a bunch of folders I was looking to zip up (and I'll wind up doing with 7zip because this isn't working). Reduced it to the very basic level (I've tried a dozen flavors of this): PowerShell code:
Output: VERBOSE: Preparing to compress... VERBOSE: Performing the operation "Compress-Archive" on target "". VERBOSE: The partially created archive file 'v:\Marvel\Alias\Alias - 022 [2003].zip' is deleted as it is not usable. VERBOSE: The archive file path 'v:\Marvel\Alias\Alias - 023 [2003]' supplied to the DestinationPath patameter does not include .zip extension. Hence .zip is appended to the supplied DestinationPath path and the archive file would be created at 'v:\Marvel\Alias\Alias - 023 [2003].zip'.
|
# ¿ Nov 14, 2022 00:17 |
|
Mario posted:It's the square brackets -- use LiteralPath instead of Path: Thanks, bud. Now, if only they hadn't hard-coded Compress-Archive to require a .zip extension.
|
# ¿ Nov 14, 2022 02:58 |
|
kumba posted:Performance improvement question: There's a lot to unpack here, but (a) as mentioned, HTML parsing is generally better done a different way, but if you want to do it this sort of way (b) avoid arrays and definitely avoid using "+=" to add things to arrays because it's a massive performance hit. There's probably a lot of ways that others will find to improve this, but here's a first pass (it's not going to give you all your pretty host output: PowerShell code:
Toshimo fucked around with this message at 22:12 on Nov 16, 2022 |
# ¿ Nov 16, 2022 21:57 |
|
If you want to skip ahead and just group up your words and count them so you can just feed that into something else, go with the following for your last line:PowerShell code:
|
# ¿ Nov 16, 2022 22:13 |
|
It's a maybe. You probably don't need Set-Location at all, but it doesn't hurt. What are you doing with the switch, exactly? Like, what does checking the first 2 characters do? It would probably be rasiest if you just gave us a dummy name like "JDoe" and said like:
Or whatever you are doing
|
# ¿ May 25, 2023 01:09 |
|
Submarine Sandpaper posted:ACLs sorta suck unless they've changed things in PowerShell. They kinda did but they still suck and I'll dig out what I used last time but I think I was still calling .Net methods
|
# ¿ May 25, 2023 01:10 |
|
The way you've described it, you want something like this:PowerShell code:
|
# ¿ May 25, 2023 04:09 |
|
Pile Of Garbage posted:Probably posted this before but I highly recommend specifying the PathType parameter whenever you're using Test-Path: https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/test-path?view=powershell-5.1#-pathtype. True, but most of the time, I don't bother because I'd set it to Any because of how many compatibility issues I have if a file and a folder with the same name exist, so I just bail on either.
|
# ¿ May 25, 2023 16:43 |
|
Pile Of Garbage posted:Genuinely interested, what environment are you in where that is a compatibility issue? Windows and POSIX has no issues with files and folders having the same name, what monstrosity are you using which doesn't? Oh, it's always some in-house piece of poo poo or something from a garbage mom-and-pop vendor who didn't account for it.
|
# ¿ May 25, 2023 17:16 |
|
Pile Of Garbage posted:Guessing you work for an MSP, unless you consider say Atlassian or SAP to be mom-and-pops lol. Whether you're uplifting existing code or integrating with legacy code it's still beneficial to use strict path checking with the PathType parameter. Pro-tip: you can use Test-Path in ValidateScript statements. See also: the Uri class that you can use to vaidate URIs to make sure they're well-formed. https://learn.microsoft.com/en-us/dotnet/api/system.uri?view=net-7.0 No, I work for a monolithic agency in the US Feddral Government.
|
# ¿ May 25, 2023 19:44 |
|
|
# ¿ May 15, 2024 18:50 |
|
Messing around with this year's Advent of Code in PS and on Day 2 (Part 2)... I have successfully solved it but I can't help but feel the way I wrote it was "some poo poo". Any thoughts on how I could cut some of this down? https://gist.github.com/Toshimo-Kamiya/c4c64fa4cea477bded97a14524e75ff6
|
# ¿ Dec 2, 2023 18:17 |